Hi, I am trying to access a aspx page controls from a COM component, in particular I need to know the position of different controls on the web page so that I can, for example, click on a button or enter text in an editbox... So far I have found that it can be done from .NET framework as explained in http://msdn.microsoft.com/en-us/library/ms178509.aspx[^] Now I would like to know how the same can be done in COM. Any help would be greatly appriciated. Thanks in advance!
scody
Posts
-
How to: COM component provide access to ASP.NET (aspx) web page controls -
BackgroundWorker method executing twiceThanks Steve! You were right, I checked the whole project for DoWork and found that the Visual Studio had already added the DoWorkEventHandler in its generated code InitializeComponent() Now after removing it, works as expected. :-D
-
BackgroundWorker method executing twiceChecked with break points at every line of code involving this event. Although the e.result of first execution is true, the bgWorker_RunWorkerCompleted doesn't handle it but handles it after second execution. Below is the sequence of the code execution as traced by break points, strange but true...:confused:
BackgroundWorker worker = sender as BackgroundWorker; //bgWorker_DoWork handler
e.Result = MyTimeConsumingTask(e.Argument, worker, e); //bgWorker_DoWork handlerThread.Sleep(10000); //MyTimeConsumingTask method
return true; //MyTimeConsumingTask mehtodBackgroundWorker worker = sender as BackgroundWorker; //bgWorker_DoWork handler
e.Result = MyTimeConsumingTask(e.Argument, worker, e); //bgWorker_DoWork handlerThread.Sleep(10000); //MyTimeConsumingTask method
return true; //MyTimeConsumingTask methodelse if ((bool)e.Result) //bgWorker_RunWorkerCompleted handler
-
BackgroundWorker method executing twiceBelow is the skeleton code which demonstrates the way I have used the BackgroundWorker class. I followed the example provided in MSDN. For some reason MyTimeConsumingTask executes twice before the bgWorker_RunWorkerCompleted handles it. Any help would be greatly appriciated.
//Form Class void bgWorker\_DoWork(object sender, DoWorkEventArgs e) { // Get the BackgroundWorker that raised this event. BackgroundWorker worker = sender as BackgroundWorker; e.Result = MyTimeConsumingTask(e.Argument, worker, e); } void bgWorker\_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { // First, handle the case where an exception was thrown. if (e.Error != null) { MessageBox.Show(e.Error.Message); } else if ((bool)e.Result) { //MyTimeConsumingTask successfully executed } else { //MyTimeConsumingTask failed } } //Form Class end //Another Class internal bool MyTimeConsumingTask(object arg, BackgroundWorker worker, DoWorkEventArgs e) { //Actual task is performed here, for simplicity sleep has been used. Thread.Sleep(10000); return true; } //Another Class end
-
'switch' statement efficiency in C#Christian Graus wrote:
What on earth makes you think that ?
One of the books on C# stated "One intriguing point about the switch statement in C# is that the order of the cases doesn’t matter—we can even put the default case first!" This statement made me think..
-
'switch' statement efficiency in C#I am new to C#, and have come across a situation where I need to perform different tasks based on the criteria value (string). Thought of using 'switch' statement, I know (from C++), if you order the 'case' statements according to most frequenly occuring 'cases' at the top, it will optimise the 'switch' statement (don't know for sure, but I practiced it), but in C#, order of the 'cases' doesn’t matter. In my situation, I would end up with around 50 'cases', so I would like to know if there are any other alternatives (to improve efficiency) apart from 'switch' statement? Any thought/help would be greatly appreciated.
-
VC# for MTA COM component developmentHi, I am in need of a MTA (Multithreaded) COM component for one of my application. I would like to know if VC# can be used to develop the MTA COM component instead of VC++? If possible, how? or any info regarding it will be helpful. Thanks in advance.
-
VC# for MTA COM component developmentHi, I am in need of a MTA (Multithreaded) COM component for one of my application. I would like to know if VC# can be used to develop the MTA COM component instead of VC++? If possible, how? or any info regarding it will be helpful. Thanks in advance.
-
Uniquely select and double click an item in the List ViewI dont have access to the code of the third party software where I am double clicking the item. I just want to invoke the item to perform some task, as if some user is double clicking the item. To cut short I am trying to test the GUI of the third party software.
-
Uniquely select and double click an item in the List ViewNo, I need to double click a list view item. Sorry, if it is confusing.. For example, if I want to double click an item named "Item Name", I should be able to click it irrespective of wherever it is positioned in the list, so I called it uniquely(that’s an exaggeration!) select.
-
Uniquely select and double click an item in the List ViewHi, I am new to Windows programming. I am trying to uniquely select and double click an item in the list view (SysListView32) in third party software. This task is somewhat similar to MyProgram trying to double click an item in a ControlPanel-like list view. To accomplish this I am sending a LVM_FINDITEM message to get the item index of the item to be double clicked.
LVFINDINFO lvfi; ZeroMemory(&lvfi, sizeof(LVFINDINFO)); lvfi.flags = LVFI_STRING; lvfi.psz = (LPCTSTR)"Item Name"; int itemIndex = ::SendMessage( aControlHWnd, LVM_FINDITEM, (WPARAM)(int)(iStart), (LPARAM)(const LVFINDINFO *)(&lvfi));
This send message is causing a runtime error. After going through some forums and message boards I found that this is due to one of the message parameter which is a pointer to a structure, as you cannot pass a pointer-to-memory to another process. :sigh: Now I would like to know how to custom marshal this message to the other process? :confused: OR Any alternative solution to uniquely select and double click an item in the list view. Any idea or solution to this problem is greatly appreciated. Thanks in advance. -
Trackbar/Sliderbar problemHi, I am new to windows programming. I want to change the slider bar position of a third party software (using WinAPI only), which I have accomplished by sending message. SendMessage( aControlHWnd, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) aPosition ); Now, the position of the sliderbar it is changed, but the corresponding values in other objects (like textbox showing the value related to this sliderbar) are not updated. I can only use Win API and donot have any access to the event handlers, but if the slider is moved manually by mouse the corresponding values in other objects (like textbox showing the value related to this sliderbar) are also changed. So I am assuming that an event handler already exists in the software which automatically updates other related objects. Now I just need to send the right message to the right handler to accomplish the task. Any help would be greatly appriciated. Thanks.
-
Sliderbar ProblemHi, I am new to windows programming. In my code I would require to change the slider bar position (I am actually invoking the sliderbar from UI using win32 API, so I donot have source code of the application), which I have accomplished by sending message. ::SendMessage( aControlHWnd, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM)(LONG) aPosition ); The problem is with the updation of the window according to the new sliderbar position, I mean, when I change the position of the sliderbar it is changed visually, but the corresponding values in other objects (like textbox showing the value related to this sliderbar) are not updated. To accomplish this I tried ::NotifyWinEvent( EVENT_OBJECT_VALUECHANGE, theDialogHWnd, OBJID_HSCROLL, CHILDID_SELF ); where theDialogHWnd is the handle for the dialog window containing the sliderbar and the textbox, but it didn't work. I am not sure if the parameters I am using are correct, or the event I am trying to notify, or may be my approach to the problem itself is wrong. I do understand that this can be easily accomplished by sending a keyboard or mouse event, but I am tryin not to use it. Any help would be greatly appriciated. Thanks.
-
Sliderbar problemHi, I am new to windows programming. In my code I would require to change the slider bar position, which I have accomplished by sending message.
::SendMessage( aControlHWnd, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM)(LONG) aPosition );
The problem is with the updation of the window according to the new sliderbar position, I mean, when I change the position of the sliderbar it is changed visually, but the corresponding values in other objects (like textbox showing the value related to this sliderbar) are not updated. To accomplish this I tried::NotifyWinEvent( EVENT_OBJECT_VALUECHANGE, theDialogHWnd, OBJID_HSCROLL, CHILDID_SELF );
where theDialogHWnd is the handle for the dialog window containing the sliderbar and the textbox, but it didn't work. I am not sure if the parameters I am using are correct, or the event I am trying to notify, or may be my approach to the problem itself is wrong. I do understand that this can be easily accomplished by sending a keyboard or mouse event, but I am tryin not to use it. Any help would be greatly appriciated. Thanks. -
OpenGL: How do I use idle func in Windows without using glutIdleFunc()Hi all, I am new to windows programming, I am converting my OpenGL program written in Linux platform into Windows platform. I have used glutIdleFunc() for idle callback func, now I would like to use the same callback func as idle func in Windows platform. How can I use a func as idle func in Windows without using GLUT. Any help would be greatly appriciated. Thanks Scody
-
How do I change icon and small icon for a windows classHi WhiteSky, I have just tried the code as you suggested
windowClass.cbSize = sizeof(WNDCLASSEX); windowClass.style = CS_HREDRAW | CS_VREDRAW; windowClass.lpfnWndProc = WndProc; windowClass.cbClsExtra = 0; windowClass.cbWndExtra = 0; windowClass.hInstance = hInstance; windowClass.hIcon = LoadIcon(windowClass.hInstance, (LPCTSTR)IDI_WINLOGO); //default Icon windowClass.hCursor = LoadCursor(NULL, IDC_ARROW); //default arrow cursor windowClass.hbrBackground = NULL; //don't need background windowClass.lpszMenuName = NULL; // no menu windowClass.lpszClassName = "AeroClass"; windowClass.hIconSm = LoadIcon(windowClass.hInstance, (LPCTSTR)IDI_WINLOGO);
but still the default application icon is displayed. I would like to use standard icon Windows logo to be displayed on my application window, so I was using NULL in my code in the previous posting. All I want to do is change the icon on my application window to Windows logo using standard icon macro IDI_WINLOGO. Any help would be greatly appriciated. Thanks Scody -
How do I change icon and small icon for a windows classHi all, I was trying to change the application icon through the windows class by changing the icon macros loaded into windows class as shown below, but no matter what icon macro I choose the icon displayed is the application icon from IDI_APPLICATION macro.
windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); //default Icon ... ... windowClass.hIconSm = LoadIcon(NULL, IDI_WINLOGO);
Could please tell how to change the icons by icon macros. Any help would be greatly appriciated. Thanks Scody -
How do I use string as a param for CreateWindowEx functionI changed my project settings to use multi-byte character set and it worked! Thanks very much! Scody
-
How do I use string as a param for CreateWindowEx functionHi all, I am trying to get the string supplied as a param in this function to be displayed as window title when executed but I am gettin compiler error. here is the code which is causing compiler error
hwnd = CreateWindowEx( NULL, "AeroClass", "Aerobatics by Scody", WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_SYSMENU | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 100, 100, 500, 500, NULL, NULL, hInstance, NULL);
and the compiler error isc:\visual studio 2005\projects\aerobatics\aerobatics\aerobatics.cpp(132) : error C2440: '=' : cannot convert from 'const char [10]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\visual studio 2005\projects\aerobatics\aerobatics\aerobatics.cpp(149) : error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'const char [10]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Can anyone please help me in gettin this string displayed on the window title when executed. Thanks Scody