|
I have created an MFC ActiveX control, in Visual C++ 6.0, that dynamically creates another ActiveX control at runtime. (I did this to create a high-level ActiveX control that wraps a low-level 3rd party ocx). The dynamically created ActiveX control has events that it fires, but I do not know how to handle these events?
Is there a way to pass the name of an event handler to the create() method and handle events this way? Do I have to use an event sink? Or reflection?
Any help, or code exmples, would be greatly appreciated...
Dave Janu
Dave Janu
Software Projects Manager
UEMSI
w137 n5560 Williams Place
Menomonee Falls, WI 53051
|
|
|
|
|
I had the same problem, I never did get it to work. You need to establish connection points in your code to correspond to the events in the 3rs party control. You then attach your connection points to the control by notifying it of their location. It kind of works like a reverse method call.
The wizards do this for you if you use them to create the control. When you have a dynamic control you have to do it yourself. Look at the Type library handling routines for a start.
I never saw a sample of this done dynamically. (I looked for a month.) I found hudreds of examples of connection points, but all were created at design time.
good luck.
Please send me a mail when you find an answer, I finally gave up and changed my design.
|
|
|
|
|
I am having problems installing a system wide hook from a service.
The hook is installed by the service when it starts. I am using PostThreadMessage() to forward messages from the hook DLL to my service's thread. At first I thought there was a problem sending the thread messages, but with further poking around I found that the DLL hook doesn't seem to be receiving any messages to forward.
I think this make be related to the "desktop" the service runs in. I have specified the "interact with desktop" flag when creating the service though.
Can anyone give me any ideas?
Thanks!
--
Dana Holt
Xenos Software
|
|
|
|
|
Hi.
I posted a thread about adding a feature to a program that searches a websites via Google. I have the basic design and implementaton done. Now I am debugging it.
I have successfully design and implement a chat program using TCP/IP and non-blocking mode via WAsynSelect(). I am using that same design with this website algorithm. I am running into a problem in this early debugging stage.
The program is I am not sure if TCP/IP and HTTP are the same or are similar. With TCP/IP and using WAsynSelect() mode, the non-blocking model relies on the Windows messaging system. With HTTP protocol, will the server, i.e. Google, send messages about the read, write, and/or close status of a socket (the socket connects the user computer to Google server via an Internet).
Thanks,
Kuphryn
|
|
|
|
|
HTTP is built on top of TCP/IP and is a TCP/IP based internet protocol. HTTP chat is funny in the sense, the client connects to the server, sends its request and then receives data till the server closes the socket connection from it's side. So it's not much of a chat in a way.
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
|
|
|
|
|
Thanks.
From some of the responses I have seen, I am getting a messages that in this program, I will have to do three things over and over again.
- connection to search engine
- send search
- receive response
- disconnection from search engine
The problem is when should you *receive*? For example, let say you send a message to search for something. When do you know the server is sending data base? With the chat program I am working on, TCP/IP sends some type of notice and then Windows messages a message to WAsynSelect(). That is who I know when to receive data. Moreover, the same works for sending data. Everything works in along with Window messaging system.
So do I need to *assume* the server will send a response immediately after I send a search message? My concern is when to call send, receive, and disconnect. With the chat program I have control over everything because the chat program is both a server and a client.
Kuphryn
|
|
|
|
|
If you're implementing the HTTP stuff on top a TCP connection governed by WSAAsyncSelect , the protocol is more or less like this:- Connect to the server.
- Send the HTTP request, terminated by a empty line. The server won't send any data back till you've finished doing this.
- Wait for the server to answer, Winsock will notify thru the event provided in
WSAAsyncSelect when incoming data arrive.
- Keep reading till the connection closes (if you're using HTTP1.0, for version 1.1 things are a little more copmlicated.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
Success! Thanks wrathgame of GameDev for the nice HTTP GET code and the other modifying HTTP handshake codes.
The program I am working on can now do a search on Google and filter out sites. The only problem I face now is determine when to stop sending GET for addition pages. Google has a limit on the number of pages in a search. For example, if you do a search for "car," I believe Google returns about 800 or so pages. Google sends ten hits per GET command, so you send the GET command 80 times. With programming, I am not sure how to determine the last page Google will send back.
Please post if there is some HTTP code that Google sends back indication that it is the last page for a particular searchkey.
Thanks,
Kuphryn
|
|
|
|
|
i have file tree control.
there are two state image lists.
one is for regular check uncheck image
the other list is only use it only for certain file (item).
so i tried to do so, but it didn't work.
m_TreeCtrl.SetImageList(&m_DupImageList, TVSIL_STATE); // setting images as checkbox
m_TreeCtrl.SetItemState(hItem,INDEXTOSTATEIMAGEMASK(2),TVIS_STATEIMAGEMASK);
m_TreeCtrl.SetImageList(&m_StatusImageList, TVSIL_STATE ); // setting images
as checkbox
do you know why>?
how should i do?
thanks
|
|
|
|
|
Hi All,
I've got a big programming problem.Need Help asap!
I've got two dialogs:
Dialog 1(Students Dialog): Has a List Ctrl Report Style which is supposed to display 3 columns from an access database(Name,Add,Tel).
Dialog 2(Add Student Dialog): Adds a new record into the database and the List Ctrl Displays it.
Then there's the Edit and Delete buttons respectively in dialog 1.
I need to know:
1) How I can display access tables using a list control
2) How I can add a simple record into the list control (or make it look like it)
3) Click on a field on the List Ctrl and (eg. Tom)-> then click EDIT and the EDIT DIALOG appears with Tom's Name and other info ready for editing.
Beginner in need of help.
Thanks so much!!
Mark Shian
Kuala Lumpur, Malaysia
|
|
|
|
|
You have to handle all these thngs yourself.Read each record from database and put them one by one into list control.
There is another list box in VC6 that you can add to your project it is good for your purpose.You can add it from the place you add other activex.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Hi there, what is a good way to run a worker thread as following:
- perform an action every 50-100 ms (variable to configure)
- meanwhile use less CPU power?
- accuracy of the configured time has to be +=100ms (that's fine but not longer!)
TRACE("me worker thread, me good\n");
for(;!bStopThread; )
{
Sleep(0);
}
TRACE("worker thread leaving\n");
|
|
|
|
|
ohhh, a simple Sleep(timeperiod_in_ms) does work! MSDN says Sleep() will suspend the thread. Wow, easy.
Which granularity can I use with Sleep(), which minimum value?
|
|
|
|
|
The argument for Sleep is in milliseconds
|
|
|
|
|
Is there a way that my program can fire an event when ANY application is opened/started.. for example my program customizes other windows, I want to know when these apps are started up so I can restore the customized options (so the user doesn't have to go back and reset all the customized options). Any ideas where I can start?
Thanks,
Rob Jones
|
|
|
|
|
You can use a global hook. Do a search here, there are a few articles on the subject. Here's a link to get you started...
--------
The real problem is that you don't have to be religious to be a religious fanatic,
you just have to be a fanatic. -- Stan Shannon, the lounge
|
|
|
|
|
How do I compare times using CTime. When I retreive a CTime value from the registry and compare it to the current time (using CTime::GetCurrentTime(), it also compares the dates which are several days apart. I need to compare the time part. Is there a way to mask out the date part then check if the current time is > or < the time saved in the registry?
Paul Jahans
|
|
|
|
|
you could create two new CTime objects like this:
CTime t1(1900,1,1,inTime1.GetHour(), inTime1.GetMin(), inTime1.GetSecond());
CTime t2(1900,1,1,inTime2.GetHour(), inTime2.GetMin(), inTime2.GetSecond());
then compare t1 and t2.
(there might be a better way, tho)
-c
Garbage collection, making life better - for weenies!
|
|
|
|
|
This is very simple. I'll use this for now unless I find a more common way. Thanks for you help Chris.
Paul Jahans
|
|
|
|
|
look at CTimeSpan, it might help you
Max
|
|
|
|
|
I've been using CSystemTray by Chris Maunder and it's really a wonderful class and made tray icon related programming very convenient.
However I found one problem, the icon shown on system tray is 16*16, so if the source icon is 32*32 it will be shrunk to 16*16, which obviously produces shape distortion. I thoughy that's not the problem because I could add a 16*16 format into the source icon so that it now has both 32*32 and 16*16 formats, but after I added new format it still uses the 32*32 format and shrinks the icon, it just seems to ignore any format in an icon but 32*32.
Now in order to let it recognize 16*16 format, I must delete(!) the 32*32 format from the source icon, by the way Visual studio 6 resource editor does not provide this feature, I had to use a third part icon editor to delete the format, now the only format remains in the icon is 16*16, and it finally worked.
Is there a way to tell the CSystemTray class to specifically choose a format from a given icon? Usually we will store both format in icon IDR_MAINFRAME, use the 32*32 for application main icon, and 16*16 for system tray displaying, that makes sense. We should not have to use two separate icons.
|
|
|
|
|
Visual Studio 6 can delete a specific "device bitmap" from an icon. Go to resource editor, open your icon and check the menu for something that looks like "Delete device bitmap" (sorry I use the german version dunno what it's named in the US version).
Hope it helps, I use the class and it works for me.
|
|
|
|
|
Great, I found the "delete device bitmap" menu, thanks.
My main problem still remains though, how do you specify an icon format? For example, you have an icon resource IDR_MAINFRAME, which consists of both 32*32 and 16*16 device formats, now how do you tell CSystemTray to "Hey, please display the 16*16 one on system tray!", can you?
|
|
|
|
|
When you load the icon, use LoadImage() and specify the size you want. This will work nicely for icon sizes, but be aware: prior to WinXP, the tray does not display icons with more than 16 colors, even if that's what you explicitly load.
--------
The real problem is that you don't have to be religious to be a religious fanatic,
you just have to be a fanatic. -- Stan Shannon, the lounge
|
|
|
|