|
i want to creat a dll in my startup project's Dbeug directroy while compileing a dll sub project.
who to do it because i have seen many example but i could not understand?
r00d0034@yahoo.com
|
|
|
|
|
Go to your project settings for teh sub DLL, and click the general tab
then there is an edit box for your output files, simply change the directory from debug to the directory where you want it to go.
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 have an MDI app using CEditView in the Doc/View architecture. In this view, I have a function like so, which I call from the Document class:
void CMyEditView::addText(LPCTSTR szOutput)
{
ASSERT_VALID(this);
int nSize = GetBufferLength();
GetEditCtrl().SetSel(nSize, nSize, TRUE);
GetEditCtrl().ReplaceSel(szOutput, FALSE);
}
After feeding it data for a while, the program inevitably crashes and the display gets corrupted. By watching the executable's resources in Task Manager, I notice that the GDI Objects are steadily increasing, until they reach 9999, and then the crash happens. By setting breakpoints, I can see that one GDI Object is consumed every time CEdit::ReplaceSel() is called, and never released.
Is this method for appending text to an Edit Control contained in a View appropriate? Anyone know a better way? Using GetWindowText() and SetWindowText() has the same problem! Any thoughts as to what's happening, and how I can prevent the resource loss?
Thanks !
scott sanders
|
|
|
|
|
I created a simple MDI application as you described and - using the same code you wrote - the GDI objects are changing between 31 and 32. It looks ok.
Where is that szOutput coming from?
rechi
|
|
|
|
|
Thank you for your reply !
After experimenting a bit more, I found out that the resource leak was actually coming from my CMyView::CtlColor() function. I was allocating a brush to change the background color of the window, depending on the program state, and never releasing it. So it was my silly fault all along; sorry to send you on a wild goose chase. I changed the brush to be static, and the problem disappeared.
Thanks again for looking into this for me.
scott
|
|
|
|
|
Intersting case, it teaches me a good little lesson.
I thank you too!
rechi
|
|
|
|
|
k i have no complaints. i have gotten this to work, but i am wondering if i may be missing anything. the only thing that changes a console based program to a windows based program is the entry point function. main vs WinMain...?? and the settings for the subsystem "windows(/Subsytem:Windows)" ?? is there anything else i should know about the entry point?
~xai~
|
|
|
|
|
That's about it AFAIK. You're hoping to write Win32 API programs, as opposed to MFC ?
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
|
|
|
|
|
yeah im developing win32 API programs... i first started with MFC and then i realized that they were just all wrapper classes. I recently bought my first sockets programming book and am extremely interested in the potential to write some pretty cool programs.. and i do know that visual c++ has wrapper classes for sockets but it is making more sense to me, knowing what is happening behind the scenes. Thanks..
xai
|
|
|
|
|
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
|
|
|
|