|
My MFC app calls a custom dll function. At various intervals I want this dll to send back some information to the calling app.
How does one do this? For example, after the dll finishes step1, I want it to send back an integer and a string to the MFC app, then after step2, another pair of int, string to the calling app etc.
If I grasp the mechanism, I can implement it hopefully in my application. The dll unfortunately is in VB so thats a complication, but the notion first, then the implemenation...
Thank,s
ns
Thanks,
ns
maybe relevant: I get to this dll by doing a #import in my VC app.
|
|
|
|
|
there are many ways to do this:
you can pass a reference or pointer to a C++ object from your app to your DLL that your DLL can call a member function on, to signal events.
or, if your DLL doesn't export C++ symbols, you can use a "callback" function, which is just a function pointer that the DLL can use to call a function in your app.
-c
As always, it's bread and circuses. And while bread is down right now, circuses are way up.
|
|
|
|
|
My dll is in VB. I am following your ideas above, and dont know how to find out about if my dll can export C++ symbols.I need more info on callback functions. Do these have a particular format? Can you please point me to links where maybe this is done...or explained further? I feel encouraged that it can be done. I was losing hope and thinking I'd have to launch the progrssbar UI from the dll itself, instead of in my VC UI status bar.
Thanks,
ns
|
|
|
|
|
Since your DLL is in VB, a good mechanism to use would be events in VB. You will create an object that handles events.
Then in your MFC app, you would create an instance of the COM object that you created in VB, and create and event sink to receive the notifications from your VB DLL.
If you DLL was in C++, you could do something much simpler with function pointers.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I guys, hope you're all in good shape.
I'd like your opinion about this: I think that C++ is very powerful in almost every kind of application (I'm interested mainly in real-time control amd monitoring), but I can't understand (even from this site, forgive me ) what Visual C can give me for building a GUI.
Thanks
Erminio
____________________________________________
It's what you do right now that makes the difference
|
|
|
|
|
What do you need to know ? I'd suggest buying a book on MFC, if you're at the point of not getting it at all, an internet post is unlikely to turn the lights on if the myriad of articles on CP have not done so for you.
Otherwise, run the wizard to create a simple dialog based program, experiment with adding controls and linking them to variables, and I'm sure you'll see what is going on. You'll certainly be able to ask more specific, and therefore answerable, questions.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Maybe the term "visual" C is throwing you off. That is simply the name of the compiler or IDE that microsoft has chosen. There is nothing special that it provides for GUI development in the form of Rapid Application Development (RAD), in the way that Visual Basic does. If this is what you want you may want to look at C++ Builder or there are addons for Visual C++ that turn it into a RAD environment.
Otherwise what it provides is a good IDE to develop and debug your code in for Win32 and MFC / ATL / WTL programs.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Is it possible to change the mask color (I think that's what it's called) of the IDR_MAINFRAME icon. Right now the transparent color of the icon is a kind of aqua color but I want to change it to white, so that any white on the icon becomes transparent as the exe icon. Is this possible? Any help is much appreciated.
- Monrobot13
|
|
|
|
|
Icons actually have a separate bitmask built into them, so the actual color shown is just a placeholder used in the editors to indicate the bits they will make transparent when it saves. If you want the white portions to be transparent, then just draw over them with the transparent "color". If you actually want to use that "aqua" color in your icon somewhere, you'll need to use a device image with greater than 16 colors in order to include it in your palette.
Shog9
------
If you really what to get shitfacde tell a crowded bar that is is yourt borthday and hife your wallet. you ka will many more friends.
- David Wulff, Brithday selebrations, 9/19/02
|
|
|
|
|
I have a progressbar in a statusbar. When a database is being generated in the app, it takes a long time. I see that to make it step along, we do something like:
for (int i = 0; i < 5000; i++) {
bar.StepIt();
}
But I need to figure out how to make the progress bar reflect the database creation progress. What indicates that the database is finished being created? How to convert that info into the counter variable that makes it step along?
ANother question:
In the following
bSuccess = CProgressCtrl::Create(dwStyle, PaneRect, pStatusBar, 1); the nID is set to 1. Is this okay? Or should I put a made up ID like "ID_PROGRESS" in the string table? I dont know if its safe to set the nID = 1.
Thanks for the help,
ns
Thanks,
ns
|
|
|
|
|
How you are creating the database?
Running a script, or running any application that you developed that crete the tables, indexes, etc?
Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
I used ADOX in visual basic in a COM Dll, then I just call this dll in my MFC app (#import). So the dll does all the work.
Thanks,
ns
|
|
|
|
|
Okey, the problem is that you build the database in a only step, from the main application that is calling to the dll....
You don't know the status of the build, or if the dll crashed, etc, etc. Is a Black Box, that only say Ready...
You need to get information from the dll, or make the build in different steps. For example:
First Step: make that the dll build the tables. (30%)
Second Step: Build the Querys, or Stored procedures, etc. (other 30%)
....
Or rebuild the dll, and make that in vc++, or modify the dll for it displays a dialog with a progress bar....
Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Hmmm...definitely food for thought. So somehow my dll has to send back info to the VC as each step gets done. Cant write the dll in VC unfortunately, too much other stuff in it thats prexisting like the populating process. The other idea that the VB display the progressbar. I guess I can try that one - at least think along those lines . I was really wanting to use Chris Maunders statusbar progress control class in the VC side....
Thanks for the suggestions,
ns
Thanks,
ns
|
|
|
|
|
I have modal dialog that gets displayed in my MDI application. I would like the dialog to handle an ID_FILE_PRINT message that is generated by the Mainframe menu. I have a message handler in the dialog to handle this message. The only problem is that while the dialog is being displayed the mainframe File-Print menu item is disabled. It appears that when the file menu is clicked the dialog looses focus, which is causing the menu item not to be enabled. I don't want to put a separate menu in the dialog.
Can anyone help me with this problem?
Gary Kirkham
A working Program is one that has only unobserved bugs
|
|
|
|
|
Send a message to the mainframe
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
I want the mainframe to send the message to the dialog
Gary Kirkham
A working Program is one that has only unobserved bugs
|
|
|
|
|
Okey, you need to use the InitModalIndirect Function
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
All this mainframe talk is bringing back bad memories from my operator days
Could we just say "Main Frame" instead :P
|
|
|
|
|
You could send the message to the mainframe. That should do it for you.
Regards,
Brian Dela
|
|
|
|
|
I want the mainframe to send the message to the dialog
Gary Kirkham
A working Program is one that has only unobserved bugs
|
|
|
|
|
My brain is fried...I meant to write MODELESS dialog
Gary Kirkham
A working Program is one that has only unobserved bugs
|
|
|
|
|
Hi
I need to resize MSChart programatically (when a user double clicks on the chart). I donot find the SetWidth(), SetHeight() functions. Any ideas how to do it?
Thanks
|
|
|
|
|
Use the MoveWindow function....
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Hi there,
I've got a program where I read the registry to get the path of an application - on XP.
Once I get that path as it is a dos formatted path I called the GetLongPathName(A) function to convert it to its long name value and I got the following error from GetLastError function:
"prescribed file doesn't exist"
In fact the folder exist but apparently XP doesn't recognize it's DOS name as a valid Windows name (?).
I scanned the "App Paths" registry and noticed that most recent application did have their path with long name form instead of the old fashioned DOS one.
So I am really confused my code is working fine on W98 but not on XP. How could I bypass the GetLongPathName function is there any substitute to convert a valid DOS name to its long name counterpart ?
Thanks,
Yarp
http://www.senosoft.com/
|
|
|
|