|
you mentioned both of the answers:
1. code resue. you can't really reuse a class in another project, if it's definition is hidden away in a .CPP somewhere.
2. convenience. if your project gets much past the HelloWorld stage, you'll start to end up with classes and modules that have logical distinctions. for your own sanity, it's best to move those into separate files to keep the parts as manageable as possible.
no, it the order in which you add them to the project doesn't matter. VC will scan them and determine the dependencies automatically so that they are built in the right order.
-c
“losinger is a colorizing text edit control”
-- googlism
|
|
|
|
|
Chris,
Thanks. I thought it would be more complicated.
|
|
|
|
|
First off, Petzold's "Programming Windows" is completely written in C. While C is very similar to C++ in syntax and many other features, it lacks support for classes and it treats structs slightly differently so be aware of this fact.
The include files are where you will generally define your consts, global functions, classes and such, and the CPP file is where you will implement them. By defining your code in an include file, you will be able to reference the things defined in the header in a number of different CPP files. This model also facilitates code re-use.
The only time that the include order is important for the header files is when a header file that is defined, depends on a previous header file being defined. Usually the header that depends on another header will include it itself, however there are cases where the order is important, especially if you use ATL.
It is actually the preprocessor that scans through the header files. In fact, the #include directive, directs the preprocessor to extract all of the text from the file that has been included, and insert that text in place of the #include directive. So you could picture all of the files that you include, as being inserted automatically for you as if you had pasted them there yourself. After the preprocessor runs, then the compiler goes through and compiles each CPP file individually.
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!
|
|
|
|
|
Paul Watt,
Thank you, this is exactly what I was looking for. I had done some searching at the MSDN site, but could not find that specific information. What I did find was information about the build process and how Visual C++ scans and interprets the file identifiers and translation units.
|
|
|
|
|
i am running my service on a computer and i want to know wheather a system is in logoff or login state?
how to get its state?
r00d0034@yahoo.com
|
|
|
|
|
Anybody got any ideas here? I have an active X control on a form view, and I am trying to do the following, with less than impressive results:
hWnd hWndControl = GetDlgItem(IDC_ACTIVEXCONTROL);
UINT nID = GetDlgCtrlID(hWndControl);
nID is equal to 0. I had hoped it would be equal to IDC_ACTIVEXCONTROL.
A dollar for anyone that can make this work.
|
|
|
|
|
I'm trying to use FindResource like this:
<br />
hResInfo = FindResource(NULL, "IDB_LOGIN", "Bitmap");<br />
I've tried "BMP", "RT_BITMAP", and RT_BITMAP as the type, but it still always fails. What am I doing wrong?
Thanks!
|
|
|
|
|
Try
<br />
hResInfo = FindResource(NULL, MAKEINTRESOURCE( IDB_LOGIN ), RT_BITMAP );<br />
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
Thanks, that works! Unfortunately, the OleLoadPicture in LoadFromBuffer in CPicture (www.codeproject.com/bitmap/cpicture.asp) fails ![Frown | :(](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_frown.gif)
|
|
|
|
|
I have a subclassed CListBox class (the name is CMyListBox ).
class CMyListBox : public CListBox
{
...
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
...
};
The problem is that the overloaded virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); member function of my class will never called!
How can I fix that?
(I am working with Embedded Visual C++ 3.0 + PocketPC / PocketPC 2002 + MFC)
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
You should:
a) make sure the listbox in question has the ownerdraw checkbox checked
b) make sure your declaration of DrawItem looks exactly like the one in the baseclass.
If this does not help then I'm afraid I can't either
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
The problem is that the same code does run perfectly under WinXP, only under CE (PocketPC / PocketPC 2002) the code doesn't run!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
From MSDN's WinCE pages:
"Windows CE does not support owner-drawn list boxes, so you cannot specify ODT_LISTBOX in the CtlType member of a DRAWITEMSTRUCT or a MEASUREITEMSTRUCT structure."
You should be able to use an ownerdraw CListCtrl though.
“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
|
|
|
|
|
I’m using Microsoft Layer For Unicode on 98. I’m not using any of CCM_Get/SETUNICODEFORMAT messages. Some of the common control as property sheet acts weired when I use IE 4. If I upgrade to IE 5, every things works as expected. I could not find any Microsoft documentation which says that I’ve to use IE 5, with UNICODe support. Is there any documentation on this?
I guess it is requirement to use IE 5 with UNICOWS, but I was hoping to find some doc to justify this
Thanks
Kasturi
|
|
|
|
|
It would be best to ask this question on the MS newgroup for MSLU. Michka, the guy who wrote the DLL, is there and will answer any questions you have.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hi,
CFileDialog dlg(TRUE);
dlg.DoModal();
the above code usually pops up a file dialog WITHOUT the outlook bar at the left (which contains shotcuts to last documents, desktop, documents, my computer, and network).
But I experienced that this very same code can open the file dialog WITH the outlook bar at its left in certain cases.
Is there some rule I am not aware of? Could somebody please enlighten me.
Thanks
R.
|
|
|
|
|
See Davide's excellent CFileDialogST[^] class for details. I now use his class exclusively.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I have a small app that just needs to open the (preferably default) web browser. The biggest problem I see is that I need to set the options, like you can in JavaScript with window.open. It there a way of doing this inside my program? If not could I have a hidden instance of the browser that uses window.open?
Thanks,
Steve
|
|
|
|
|
if you run "about:blank" using your favorite system-command-executor (WinExec, spawn, etc.) it will launch the default browser.
-c
“losinger is a colorizing text edit control”
-- googlism
|
|
|
|
|
Yes but that gives me no control over the look of the browser, size, toolbars ect. ![Smile | :)](https://www.codeproject.com/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
write a little HTML page that contians the JScript to set the things you need, then launch that page (again, using WinExec) ?
“losinger is a colorizing text edit control”
-- googlism
|
|
|
|
|
Well yea, I could do that. But then I would have another open window that I don't want. I found a soultion to another problem that will let me do it a different way so this is no longer needed. Thanks for your help.
|
|
|
|
|
My problem is that when i try to use ICDraw, nothing happens. I've done exactly what the MSDN says, but it's not working
Here's my code:
DWORD dw;
DWORD dwNumBuffers = 0;
ICDrawBegin(hVideo, ICDRAW_FULLSCREEN, NULL, NULL, NULL, 0, 0, 0, 0, &VideoInfo.bmiHeader, 0, 0, VideoInfo.bmiHeader.biWidth, VideoInfo.bmiHeader.biHeight, VideoHeader.dwRate, VideoHeader.dwScale);
avi.ReadNextVideoFrame(lpData, VideoInfo.bmiHeader.biWidth * VideoInfo.bmiHeader.biHeight * 24 / 8, VideoInfo.bmiHeader.biCompression);
ICGetBuffersWanted(hVideo, &dwNumBuffers);
for (dw = 0; dw < dwNumBuffers; dw++)
{
ICDraw(hVideo, 0, (LPVOID)&VideoInfo.bmiHeader, lpData, VideoInfo.bmiHeader.biWidth * VideoInfo.bmiHeader.biHeight * 24 / 8, dw);
}
ICDrawStart(hVideo);
dw = 0;
for (int i = 1; i < (int)((float)VideoHeader.dwRate / VideoHeader.dwScale * 60); i++)
{
avi.ReadNextVideoFrame(lpData, VideoInfo.bmiHeader.biWidth * VideoInfo.bmiHeader.biHeight * 24 / 8, VideoInfo.bmiHeader.biCompression);
ICDraw(hVideo, 0, (LPVOID)&VideoInfo.bmiHeader, lpData, VideoInfo.bmiHeader.biWidth * VideoInfo.bmiHeader.biHeight * 24 / 8, dw);
}
ICDrawStop(hVideo);
ICDrawFlush(hVideo);
ICDrawEnd(hVideo);
The avi.ReadNextVideoFrame() is a function that reads the next videoframe from the avifile. I'm not sure i'm doing it right, i don't think the MSDN illustrates very clearly how to do it.
Thanks all!
-Rune Svendsen
|
|
|
|
|
Hi,
I get an error with this code when I try to delete the object (CWindowImpl)
LRESULT CWndNotify::OnTimer(UINT nMsg, WPARAM wParam,
LPARAM lParam, BOOL& bHandled)
{
switch( nTimer )
{
case ...:
{
break;
}
case ...:
{
KillTimer( TIMER_COLLAPSE );
delete this;
break;
}
...
I get this assertion error:
pThis->m_pCurrentMsg == &msg
I tried Detatch() and DestroyWindow() before delete but it doesn't help. How should I destroy the window?
Thanks!
---------------
Concentrating on Ideas
http://www.edovia.com
|
|
|
|
|
Hello,
Use DestroyWindow and forget the "delete this". "Delete this" doesn't make any sense here.
-Dominik
|
|
|
|