Search Results

Search found 56525 results on 2261 pages for 'com'.

Page 83/2261 | < Previous Page | 79 80 81 82 83 84 85 86 87 88 89 90  | Next Page >

  • Abstract Methods in "Product" - Factory Method C#

    - by Regina Foo
    I have a simple class library (COM+ service) written in C# to consume 5 web services: Add, Minus, Divide, Multiply and Compare. I've created the abstract product and abstract factory classes. The abstract product named WS's code: public abstract class WS { public abstract double Calculate(double a, double b); public abstract string Compare(double a, double b); } As you see, when one of the subclasses inherits WS, both methods must be overridden which might not be useful in some subclasses. E.g. Compare doesn't need Calculate() method. To instantiate a new CompareWS object, the client class will call the CreateWS() method which returns a WS object type. public class CompareWSFactory : WSFactory { public override WS CreateWS() { return new CompareWS(); } } But if Compare() is not defined as abstract in WS, the Compare() method cannot be invoked. This is only an example with two methods, but what if there are more methods? Is it stupid to define all the methods as abstract in the WS class? My question is: I want to define abstract methods that are common to all subclasses of WS whereas when the factory creates a WS object type, all the methods of the subclasses can be invoked (overridden methods of WS and also the methods in subclasses). How should I do this?

    Read the article

  • Hooking the http/https protocol in IE causes GET requests to be sequential

    - by watsonmw
    I'm using the PassthruAPP method to hook into HTTP/HTTPS requests made by IE. It's working well for the most part, however I noticed a problem. Only one download thread is active at a time. I can see two IInternetProtocol objects getting created, but IE uses only one at a time. This is happening with IE7. The odd thing is that the problem occurs when overriding the existing default HTTP/HTTPS handler, even if the handler is not the one being used to make the request. E.g. Registering a handler for the HTTPS protocol will cause HTTP requests to be made sequentially, even though HTTP requests are not hooked. I installed Google Gears and it has the same problem. This always happens for the first few items on the page, but it seems that after the document complete is issued, concurrent downloads can occur again. For example Javascript code that is executed after the page has finished loading can load images concurrently just fine. One option is to try to IAT patch the 'IInternetProtocol' registered for HTTP requests, but Google Gears does this already and it has the same problem. I know installing a HTTP Proxy is another option, but I don't want to monkey with the users' HTTP Proxy settings if there another option.

    Read the article

  • Temporarily save Word document changes

    - by willvv
    Hi I'm using Interop to create a "custom word editor", basically I've incorporated MS Word on my application and I allow users to edit a document and insert custom fields from a predefined list. I provide a "Preview" option to see how the document will appear when the data is added. The users can start editing a template on my application, and at any time they can hit preview and the preview should appear with the latest changes. I want the user to be able to preview the document without saving the changes, the problem is that when I invoke SaveAs() on the document (to create a temp file that I can use as the input for the preview generator), the editor opens the temp document. Is there a way to save a copy of the document being edited but keep the original (open) document with its changes unsaved? Thanks a lot

    Read the article

  • Moving delegate-related function to a different thread

    - by Chris
    Hello everybody. We are developing a library in C# that communicates with the serial port. We have a function that is given to a delegate. The problem is that we want it to be run in a different thread. We tried creating a new thread (called DatafromBot) but keep using it as follows (first line): comPort.DataReceived += new SerialDataReceivedEventHandler(comPort_DataReceived); DatafromBot = new Thread(comPort_DataReceived); DatafromBot.Start(); comPort_DataReceived is defined as: Thread DatafromBot; public void comPort_DataReceived(object sender, SerialDataReceivedEventArgs e) { ... } The following errors occur: Error 3 The best overloaded method match for 'System.Threading.Thread.Thread(System.Threading.ThreadStart)' has some invalid arguments C:...\IR52cLow\CommunicationManager.cs 180 27 IR52cLow Error 4 Argument '1': cannot convert from 'method group' to 'System.Threading.ThreadStart' C:...\IR52cLow\CommunicationManager.cs 180 38 IR52cLow Any ideas of how we should convert this to get it to compile? Please note that comPort.DataReceived (pay attention to "." instead of "_") lies within a system library and cannot be modified. Thanks for your time! Chris

    Read the article

  • Internet Explorer cannot 'fully' load ActiveX Control

    - by K Browne
    Context I am migrating an installer for an ActiveX control from Per-Machine to Per-User. I did this by programming the installer write to HKCU\Software\Classes instead of HKLM\Software\Classes. Problem On my machine (Windows 7 with UAC Enabled), the ActiveX control successfully loads. On the other windows 7 test machines (one with UAC enabled, one with UAC disabled), the control 'partially' loads. What is Partially? When a user visits a page with the ActiveX control, Internet Explorer displays a warning message in a yellow bar on the top of the window. If you click the 'Run add-on' button in the bar, the control becomes visible and begins to run, but Javascript code that tries to access properties of the control return the error: Library not registered. Differences between machines On the dev machine reads from HKCR\CLSID\<GUID> succeed while on the test machines these reads fail. Reads from HKCU succeed on both dev and test machines. Reads from HKLM fail on both test and dev machines. (I collected reads using Sysinternals Process Monitor) Strangely, the keys that Internet Explorer fails to read are clearly visible if I use regedit to view HKCR\CLSID\<GUID> on the test machines. Question What can I do to get the per-user control to load on the test machines? What could cause this difference between the dev machine and the test machines? Why can I see the key in HKCR with RegEdit but Internet Explorer cannot see the key? Any help is appreciated. Thank you.

    Read the article

  • Trying to populate ListView in Android using objects from Parse

    - by mrwienerdog
    I am pretty darned new to android, and VERY new to Parse. I have created a class, StudentInformation, that includes columns for name, address, phone, etc. I would like to create a listview that contains the names of all students added to the class. How do I do this? I have got it to the point that I can Toast out the objectIDs of all of my entries, but can't figure out how to extract and add just the names to the ListView. Here is a snippet of the code: //Set up the listview studentListView = (ListView)findViewById(R.id.listViewStudents); //Create and populate an ArrayList of objects from parse ParseQuery query = new ParseQuery("StudentInformation"); final ArrayList<Object> studentList = new ArrayList<Object>(); query.findInBackground(new FindCallback() { public void done(List<ParseObject> objects, ParseException e) { if (e == null) { Toast.makeText(getApplicationContext(), objects.toString(), Toast.LENGTH_LONG).show(); for(int i = 0;i < objects.size(); i++){ objects.get(i); studentList.add("name".toString()); } } else { Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_LONG).show(); } } }); //studentList.addAll(Arrays.asList(students)); listAdapter = new ArrayAdapter<Object>(this,android.R.layout.simple_list_item_1,studentList); studentListView.setAdapter(listAdapter); } I have left the toast in where I toatst out the objectIDs in the public void done.... method. Any help would be, as always, greatly appreciated. Should be mentioned (possibly), no errors are thrown, the listview just never gets populated after the toast disappears. Don't know if this will help anyone, but I took a bit from both posts below, and came up with this: //Set up the listview studentList = new ArrayList<String>(); //Create and populate an ArrayList of objects from parse listAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1); studentListView = (ListView)findViewById(R.id.listViewStudents); studentListView.setAdapter(listAdapter); final ParseQuery query = new ParseQuery("StudentInformation"); query.findInBackground(new FindCallback() { public void done(List<ParseObject> objects, ParseException e) { if (e == null) { //Toast.makeText(getApplicationContext(), objects.toString(), Toast.LENGTH_LONG).show(); for (int i = 0; i < objects.size(); i++) { Object object = objects.get(i); String name = ((ParseObject) object).getString("name").toString(); listAdapter.add(name); } } else { Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_LONG).show(); } } });

    Read the article

  • How can I access the JavaScript global object ("window") inside an embedded browser object (the IWebBrowser2 interface)?

    - by John Factorial
    I have an HTML page which embeds an IWebBrowser2 ActiveX (i.e. the control is essentially an Internet Explorer browser). I need to write JavaScript in this HTML page which will remove any window.onresize handler from the page loaded in the IWebBrowser2 control. IWebBrowser2 exposes the DOM through IWebBrowser2::Document, but this is equivalent to window.document. Is there any way I can get access to window or window.onresize?

    Read the article

  • Should a Stack have a maximum size?

    - by Sotirios Delimanolis
    I'm practicing my knowledge of ADTs by implementing some data structures, even if most already exist. With Stacks, a lot of books and other documentation I've read talk about the stack throwing an error when you try to add an element but the stack is full. In a java implementation (or any other), should I specifically keep track of a maximum stack size (from constructor), check to see if that size is reached, and throw an overflow exception if it is? Or is not such a big deal?

    Read the article

  • Problem catching OnClick event using HTMLDocumentEvents2 in a BHO

    - by Yonatan
    I am running a BHO and i am trying to catch OnClick events using HTMLDocumentEvents2 however, the events never seem to reach the handler this is what i am doing: class ATL_NO_VTABLE CBlastBhoBHO : public CComObjectRootEx<CComSingleThreadModel>, public CComCoClass<CBlastBhoBHO, &CLSID_BlastBhoBHO>, public IObjectWithSiteImpl<CBlastBhoBHO>, public IDispatchImpl<IBlastBhoBHO, &IID_IBlastBhoBHO, &LIBID_BlastBhoLib, /*wMajor =*/ 1, /*wMinor =*/ 0>, public IDispEventImpl<0, CBlastBhoBHO, &DIID_HTMLDocumentEvents2, &LIBID_MSHTML, 1, 0>, public IDispEventImpl<1, CBlastBhoBHO, &DIID_DWebBrowserEvents2, &LIBID_SHDocVw, 1, 1> BEGIN_SINK_MAP(CBlastBhoBHO) SINK_ENTRY_EX(0, DIID_HTMLDocumentEvents2, DISPID_HTMLDOCUMENTEVENTS2_ONCLICK, OnClickTrigger) SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOCUMENTCOMPLETE, OnDocumentComplete) END_SINK_MAP() // Handlers void STDMETHODCALLTYPE CBlastBhoBHO::OnDocumentComplete( IDispatch *pDisp, VARIANT *url) { // works fine } void STDMETHODCALLTYPE CBlastBhoBHO::OnClickTrigger(IHTMLEventObj *pEvtObj) { // Never called } // From SetSite() ATL::IDispEventSimpleImpl<1,CBlastBhoBHO,&DIID_DWebBrowserEvents2>::DispEventAdvise(m_spWebBrowser); // From OnDocumentComplete CComQIPtr<IHTMLDocument3> doc_; m_spWebBrowser->get_Document((IDispatch**) &doc_); ATL::IDispEventSimpleImpl<0,CBlastBhoBHO,&DIID_HTMLDocumentEvents2>::DispEventAdvise(doc_); I have tried several variations(using HTMLElementEvents2 etc) or Advising on different objects or Advising on the document from SetSite. my handler is never called. Any help would be much appreciated. all i need is the onClick event.

    Read the article

  • Retrieving dll version info via Win32 - VerQueryValue(...) crashes under Win7 x64

    - by user256890
    The respected open source .NET wrapper implementation (SharpBITS) of Windows BITS services fails identifying the underlying BITS version under Win7 x64. Here is the source code that fails. NativeMethods are native Win32 calls wrapped by .NET methods and decorated via DllImport attribute. private static BitsVersion GetBitsVersion() { try { string fileName = Path.Combine( System.Environment.SystemDirectory, "qmgr.dll"); int handle = 0; int size = NativeMethods.GetFileVersionInfoSize(fileName, out handle); if (size == 0) return BitsVersion.Bits0_0; byte[] buffer = new byte[size]; if (!NativeMethods.GetFileVersionInfo(fileName, handle, size, buffer)) { return BitsVersion.Bits0_0; } IntPtr subBlock = IntPtr.Zero; uint len = 0; if (!NativeMethods.VerQueryValue(buffer, @"\VarFileInfo\Translation", out subBlock, out len)) { return BitsVersion.Bits0_0; } int block1 = Marshal.ReadInt16(subBlock); int block2 = Marshal.ReadInt16((IntPtr)((int)subBlock + 2 )); string spv = string.Format( @"\StringFileInfo\{0:X4}{1:X4}\ProductVersion", block1, block2); string versionInfo; if (!NativeMethods.VerQueryValue(buffer, spv, out versionInfo, out len)) { return BitsVersion.Bits0_0; } ... The implementation follows the MSDN instructions by the letter. Still during the second VerQueryValue(...) call, the application crashes and kills the debug session without hesitation. Just a little more debug info right before the crash: spv = "\StringFileInfo\040904B0\ProductVersion" buffer = byte[1900] - full with binary data block1 = 1033 block2 = 1200 I looked at the targeted "C:\Windows\System32\qmgr.dll" file (The implementation of BITS) via Windows. It says that the Product Version is 7.5.7600.16385. Instead of crashing, this value should return in the verionInfo string. Any advice?

    Read the article

  • .NET: How does the use of components in .NET differ to pre-.NET?

    - by Craig Johnston
    How does the use of components in .NET differ to pre-.NET? I see the differences as: .NET components don't have to be centrally registered on a machine and can merely be invoked at run-time from a specified location if .NET components are 'registered' in the GAC, problems asociated with different versions of the same DLL ("DLL hell") are avoided because each version will have its own id/key which is known to the calling program Is the above correct, and what other relevant differences are there?

    Read the article

  • Sending binary data from ASP to .net component

    - by john
    The ASP application allows uploading of image files (jpg, gif, tif). These files are sent to a .net component registered in the GAC of the server. In the component file is encoded using System.Text.Unicode to byte[] array. This encoding is done with some data loss. The byte array has values 253 and 255 in consequetive elements. What could be the problem ? I'm sending the binary data as a string. Please help me... Thanks in advance, John

    Read the article

  • import data from the objects created in salesforce

    - by javatechi
    Hi All, I have created an app in salesforce platform, i have some primitive records in that, i need to import them in visual force. For example,if we create a record in Account in Salesforce,,, like charles,Jennifer,Tom and all i need to import them in visualforce and do things which i can do in salesforce..please help me out with this Thanks

    Read the article

  • VC++ Charts using Chart X

    - by Arjun
    Hi, I'm new to drawing the chart using chartfx can you give me the meanings of teh following methods, they are kinda confusing...I did not find documentation anywhere. GetValue ( ) GetXValue ( ) PutItem() Thanks, Arjun

    Read the article

  • ImpersonateLoggedOnUser and starting a new process that uses ocx fails.

    - by markus
    I write a c++ windows application (A), that uses LogonUser, LoadUserProfile and ImpersonateLoggedOnUser to gain the rights of another user (Y). Meaning the A starts using the user that is logged on on the workstation (X). If the user wants to elevate his rights he can just press a button and logon as another user without having to log himself out of windows and back in. The situation now is (according to the return values of the functions): LogonUser works, LoadUserProfile works and ImpersonateLoggedOnUser works as well. After the impersonation I start another process. This process is an application (B) that needs an OCX control. This fails and the application tells me that the .oxc file is not properly installed. The thing is, if I start B directly as the user that is logged on to the machine (X), it works. If I start B directly as the user (Y) to which I want to elevate my rights using A, it works. If I am logged in as (X) and choose "run as" (Y) in the explorer, it works! Do you know which steps I need to do to do the same as the "run as" dialog from windows?

    Read the article

  • To what degree should I use Marshal.ReleaseComObject with Excel Interop objects?

    - by DanM
    I've seen several examples where Marshal.ReleaseComObject() is used with Excel Interop objects (i.e., objects from namespace Microsoft.Office.Interop.Excel), but I've seen it used to various degrees. I'm wondering if I can get away with something like this: var application = new ApplicationClass(); try { // do work with application, workbooks, worksheets, cells, etc. } finally { Marashal.ReleaseComObject(application) } Or if I need to release every single object created, as in this method: public void CreateExcelWorkbookWithSingleSheet() { var application = new ApplicationClass(); var workbook = application.Workbooks.Add(_missing); var worksheets = workbook.Worksheets; for (var worksheetIndex = 1; worksheetIndex < worksheets.Count; worksheetIndex++) { var worksheet = (WorksheetClass)worksheets[worksheetIndex]; worksheet.Delete(); Marshal.ReleaseComObject(worksheet); } workbook.SaveAs( WorkbookPath, _missing, _missing, _missing, _missing, _missing, XlSaveAsAccessMode.xlExclusive, _missing, _missing, _missing, _missing, _missing); workbook.Close(true, _missing, _missing); application.Quit(); Marshal.ReleaseComObject(worksheets); Marshal.ReleaseComObject(workbook); Marshal.ReleaseComObject(application); } What prompted me to ask this question is that, being the LINQ devotee I am, I really want to do something like this: var worksheetNames = worksheets.Cast<Worksheet>().Select(ws => ws.Name); ...but I'm concerned I'll end up with memory leaks or ghost processes if I don't release each worksheet (ws) object. Any insight on this would be appreciated.

    Read the article

  • Drag and Drop text - What am I missing?

    - by Harvey
    I am trying to add drag-and-drop text to my Doc-View App. I added the COleDropTarget variable to the view class, registered it in OnCreate(). I added OnDragEnter(), OnDragOver(), OnDragLeave() and OnDrop() to that class as virtual overrides, but none of them are ever called. I previously had added m_pMainWnd-DragAcceptFiles(TRUE); to my App class. I tried commenting out that statement, but no affect. I tried using Spy++ to see where the messages go while I do a drag, but it logs nothing at all while I am dragging the text around in the App. What do I need? Or what else can I try, to narrow down the problem? TIA, Harvey

    Read the article

  • How to use DLL reference with an ActiveX <object> via JavaScript

    - by John Factorial
    My question: how can I set an ActiveX object's property via JavaScript to an enum value found in a non-ActiveX DLL? Problem description: I am instantiating an ActiveX object with the following object tag: <object classid="clsid:F338193D-2491-4D7B-80CE-03487041A278" id="VideoCapture1" width="500" height="500"></object> (This is the guid for the 3rd party ActiveX I'm using, "VisioForge_Video_Capture_4.VFVideoCapture4X") I have example C# code for using this ActiveX, which I am porting to JavaScript. Code like this works just fine: VideoCapture1.Debug_Mode = true; var devcount = VideoCapture1.Video_CaptureDevices_GetCount(); var devs = []; for (var i =0; i < devcount; ++i) { devs[devs.length] = VideoCapture1.Video_CaptureDevices_GetItem(i); } ... etc ... However, VideoCapture1 has some settings which refer to a DLL enum, like so (C# code): VideoCapture1.Mode = VisioForge_Video_Capture_4.TxVFMode.Mode_Video_Preview; I can see in Visual Web Developer that TxVFMode.Mode_Video_Preview is value 1 in the enum. However, the following JS does not appear to set the Mode properly: VideoCapture1.Mode = 1; Does anyone know how I can set VideoCapture1.Mode to the enum value found in the TxVFMode? PS: In Visual Web Developer, when I "Go to definition" on TxVFMode, I get the Guid for the enum. I thought I could create an with this Guid or instantiate a VisioForge_Video_Capture_4.TxVFMode in JS, but neither gives me a usable object.

    Read the article

  • Using MFC classes inside ATL Project

    - by user196614
    Hi, I have created an ATL Project with all default options using VC++ 2008. I have added Simple ATL object (interface IDemo) and some interface moethos inside the simple object. I want to use MFC classes (e.g. CDatabase, CRecordset and lots more) inside my ATL project. How can I achieve this? Thanks.

    Read the article

  • How to reliably replace a library-defined error handler with my own?

    - by sharptooth
    On certain error cases ATL invokes AtlThrow() which is implemented as ATL::AtlThrowImpl() which in turn throws CAtlException. The latter is not very good - CAtlException is not even derived from std::exception and also we use our own exceptions hierarchy and now we will have to catch CAtlException separately here and there which is lots of extra code and error-prone. Looks like it is possible to replace ATL::AtlThrowImpl() with my own handler - define _ATL_CUSTOM_THROW and define AtlThrow() to be the custom handler before including atlbase.h - and ATL will call the custom handler. Not so easy. Some of ATL code is not in sources - it comes compiled as a library - either static or dynamic. We use the static - atls.lib. And... it is compiled in such way that it has ATL::ThrowImpl() inside and some code calling it. I used a static analysis tool - it clearly shows that there're paths on which the old default handler is called. To ensure I even tried to "reimplement" ATL::AtlThrowImpl() in my code. Now the linker says it sees two declarations of ATL::AtlThrowImpl() which I suppose confirms that there's another implementation that can be called by some code. How can I handle this? How do I replace the default handler completely and ensure that the default handler is never called?

    Read the article

  • Trying to use SHCreateShellItem, having #include issues

    - by dreamlax
    There is a function in called SHCreateShellItem which is declared in <shlobj.h>, but it has been #ifdef'd out based on whether or not _WIN32_IE is greater than or equal to 0x601 (if it is, then the declaration is present). However, even when I define _WIN32_IE to 0x601 before I include <shlobj.h>, MSVC++ still complains that SHCreateShellItem is undeclared. For example, I cannot get the following to compile: #define _WIN32_IE 0x601 #include <shlobj.h> int someFunction (LPITEMIDLIST parent, LPITEMIDLIST child) { HRESULT result; IShellItem *shellObj; result = SHCreateShellItem (parent, NULL, child, &shellObj); if (SUCCEEDED(result)) { // do stuff } return SUCCEEDED(result); } Do I need to define _WIN32_IE in a different way?

    Read the article

< Previous Page | 79 80 81 82 83 84 85 86 87 88 89 90  | Next Page >