|
in the init_instance of your program you have to call
BOOL CSetTimeApp::InitInstance()
{
...
CMyDlg dlg;
dlg.Create (IDD_MYDIALOG, NULL);
dlg.ShowWindow (SW_HIDE);
....
hope this helps... (i can't help you with the sheband with your icon)
bernhard
""Politicians and diapers have one thing in common. They should both be changed regularly and for the same reason."
|
|
|
|
|
I have a collection of .cpp modules (some classes some just methods) that I use in my various projects. How do you orgainze these shared modules? I'm starting to get classes that depend on other classes and when I use one in a project I don't what other files I need until I get link errors. So I'm wondering how you folks oganize your shared source repositories. Keep in mind that my applications have to be as small as possible so I can't turn them into a library of some kind.
Todd Smith
|
|
|
|
|
putting functions and classes in a library doesn't really increase the size of the application that uses them. linkers are smart enough nowdays to only pull in the functions/members they need.
i put my stuff in libraries.
-c
POKE 808,234
|
|
|
|
|
I've never had a clear explanation of the advantages of putting the files in libraries, either. Seems it's done that way just because C programmers used to do it that way.
OK, it's because you can distribute the libraries and headers without source; but for internal use, where's the advantage?
|
|
|
|
|
i do it because it keeps all of my utility functions in a single project (i call mine ToolLib). it helps keep my application projects smaller (VC tends to slow down when projects get too big). i just drop all of my utils into Toollib and manage them as a subproject. and, i don't have to worry about adding each utility class file to my projects separately - include the lib project, link to it and that's it.
-c
POKE 808,234
|
|
|
|
|
Libs are good places to store 'the one you wrote earlier'.
How to group code in Libs has always been a point for argument amongst programmers (tsk, as if programmers would argue). My personal preference comes from my electronics. I would create libraries of devices. With the code controlling all aspects of that device, so that a calling function would (in many cases) have a single call in and a single status/data call.
So for example,
irq59.lib would hold all the routines tat control an irq controller.
pcdisp.lib all of the character display device code.
and so on.
In C++ I tried a few in the lines of,
dirtree.lib with the code for Directory trees
omron.lib code to control an Omron
In each case it is code that is fixed in terms of its operation and only requires control/data to work.
It is just as easy in the IDE to add a class into a project in source form. But as was said earlier you have to remember to add all the right base classes, with the libs you must have already taken care of this for your code to have compiled.
We do it for the joy of seeing the users struggle.
|
|
|
|
|
Keep in mind that my applications have to be as small as possible so I can't turn them into a library of some kind.
You can if the library is static. In this case, the linker discards the code not used by the program.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I simply have a set of directories where I group together related classes. e.g I have my MFCExt folder and my littleTAPI folder and a Template folder. I then just add the relevant files to my projects.
I used to use static libraries but problems with linking the same libraries to MFC, ATL, WIN32 projects has changed my mind.
Michael
|
|
|
|
|
Our product RadVC employs a similar concept of C++ control repository you've just mentioned. Whenever a new C++ control (we call them RAD C++ controls, because they can be used in a RAD environment later on) is created or installed, the source files of the control are saved in the respective directories (such as .cpp in \\src, .h in \\include, resource files in \\res directories etc.).
The fun part is, as you've pointed out, these files don't need to be copied again and again every time they are used in new projects.
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
Right now my program is an MDI, where you have to select an item in the menu bar to open up the opengl window. The opening of the opengl window works fine
except for the fact that when I minimize the child window the animating objects appear in the paretn window. Can anyone help me figure out how to make sure the animation only appears in the child window.
|
|
|
|
|
Is it possible to change full ActiveX control's size (extents) from inside control at run-time, sort of notifying the container about the change in size, so then the container would call GetExtent and the control would let him know of its prefferd size.
|
|
|
|
|
How can I change the title of a sdi application?
I used CDocument->SetTitle() - doesn't work (nothing changes)
used CMainFrame->SetWindowText - but this crashes my app (Unhandled exception - memory violation - as It got a NULL pointer, when i debugged, inside the MFC function SetWindowText, there was an ASSERT(::IsWindow(m_hWnd)), but this(==m_hWnd) was equal to NULL, so that is why there was memory violation ...
used m_pszAppName (changed it) and nothing changes ...
heard about taking care of OnUpdateFrameTitle, but this method is not a member of frame, or document, but an ole class ...
used many other strange ways, and did not succeed ...
Anyone having an idea ?PLZ
|
|
|
|
|
Where abouts in your code were you changing the window title via the CMainFrame::SetWindowText. It sounds like you were trying to do it before the window was created.
Michael
|
|
|
|
|
Inside the CDocument constructor, I wanted to change the title bar, when the document changes in some way... and I call a function (which calls CMainFrame::SetWindowText() ) from CDocument's constructor, and if this constructor is called when the frame doesn't exist, that is the answer... hey, thank you, I hope that is the case
|
|
|
|
|
I pulled this example from Michael Dunn's Article at http://www.codeproject.com/listctrl/lvcustomdraw.asp... I'm lost
how do I repaint the headder instead of items?
void CMyDlg::OnCustomdrawMyList ( NMHDR* pNMHDR, LRESULT* pResult )
{
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
*pResult = CDRF_DODEFAULT;
if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYITEMDRAW;
}
else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
{
COLORREF crText;
if ( (pLVCD->nmcd.dwItemSpec % 3) == 0 )
crText = RGB(255,0,0);
pLVCD->clrText = crText;
*pResult = CDRF_DODEFAULT;
}
}
Thanks,
Rob
|
|
|
|
|
I have not actually done this before, but the header is a different control, so I don´t think you should use the custom draw of the list. CHeaderCtrl supports custom draw (search for the term in MSDN), writing a separate handler for its NM_CUSTOMDRAW should allow you to format the header.
Hope this will set you in the right direction.
/moliate
|
|
|
|
|
I'm looking for some useful explanations of the Memory resources displayed in WIn9x System Monitor (under Accessories); esp.
reserved memory (mostly but not always correlates to swap file usage + Physical memory used)
Do you know any article, web site etc. that does explain some deeper things about the memory managment?
(I'm combatting some weird memory hog... no fun)
TIA Peter
|
|
|
|
|
Hi,
I am using GDI+ to convert a batch of TIFFS to JPEGS - i was just wondering how i can resize a image object and then save it out. Does it have to go via a 'graphics' object? and if so how?
Cheers
Richard
|
|
|
|
|
Yes, you can resize it by drawing it onto a graphics object of the right size, making sure you stretch it at the same time. The best function in my opinion for this is Graphics::DrawImage.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
Hi,
I (desperately) need a list of running processes (ID orHandle, and Module name), on Win 9x (more important) and NT/W2K. I know I know this gets asked often, but couldn't find any on CP..
Thanks a lot!
Peter
|
|
|
|
|
I think there is a sample in the platform sdk, PViewer or something like that. So a search on MSDN for Process Viewer.
Michael
|
|
|
|
|
http://www.codeproject.com/threads/interprocesssync.asp
--------------------------------------------------
If my messages appear curt, I apologize.
I try to be brief to save your time as well as mine.
--------------------------------------------------
|
|
|
|
|
MSDN Search:
HOWTO: Enumerate Applications in Win32
Q175030
The information in this article applies to:
Microsoft Win32 Application Programming Interface (API), used with:
the operating system: Microsoft Windows NT, version 4.0
Microsoft Windows 95
the operating system: Microsoft Windows 2000
Definitely one of the best starting points to do it.
|
|
|
|
|
Use CreateToolhelp32Snapshot, Process32First and Process32Next defined in tlhelp32.h. It works on Win9x as well as NT (PSAPI gives you more control, but only works on NT).
/moliate
|
|
|
|
|
Actually, ToolHelp32 funtions are *not* available on NT4, according to MSDN. W2K supports them, however.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|