|
Hi,
Thanks for the reply. Actually, it works by giving the common "StdAfx.h" as the precompiled header for all the source files under different sub directories of the project.
However, when i try to open the StdAfx.h file (using "Open document") from the #include "StdAfx.h" in the cpp file (which is in the sub directories), it is opening a StdAfx.h file of another DLL project. I am not sure if the compiler is taking the proper StdAfx.h file during compilation.
Actually, we have around 20 DLL projects under the same "Sources" directory and each one of these DLLs has a separate StdAfx.h file. How can we be sure that the StdAfx.h file included in a DLL is not referenced by the source files of another DLL project?
Thanks,
Raghav
|
|
|
|
|
I am not sure, except to check your global includes setting and then to check the preprocessor setting for the debug and release of each project.
Also, it is possible that one of the paths might have snuck into an environment variable, but I thought those are only used for command line builds.
I usually do this, and have avoided many problems as a result:
1. I put ONLY the Platform SDK include paths into the global include paths (Tools Menu, Options Menu, Dirctores Tab, Include Files)
2. I never put anything implying a relative path for the stdafx.h. It is always plainly
#include "stdafx.h"
3. I modify the preprocessor setting for each project to include the local directory first as in "." and then follow it with the other folders required.
4. I never place a stdafx.h or stdafx.cpp in a folder that is going to contain 'shared' header or source files, as this will lead to the confusion about which stdafx.* to actually include.
I think someone wrote a 'header dependency walker' type tool and posted it on CodeProject. Maybe it will help you to determine which files are including which stdafx.h
|
|
|
|
|
Hi,
Thanks for the helpful information. I have modified the preprocessor settings accordingly. I also searched for the header dependency walker, but could not locate it in CodeProject or elsewhere. Please let me know if you have the link to it.
Thanks,
Raghav
|
|
|
|
|
|
hi,
i want to make an app which will be able to transfer files over bluetooth, over the obex file transfer profile. since i am a novice to both networking and visual c++ plz help me find an easy to use api or a sockets implementation for this or guide me how to do the same
|
|
|
|
|
I want to write wmi program using vc++(win32).Beacause c++.net or c# does not run on win98.How can i do this?Can u give some examples?
Please help me...
A lot of thanx...
|
|
|
|
|
I think you will probably need to implement use the IWbemLocator, IWbemServices and IWbemObjectSink interfaces. What are you trying to achieve?
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
I am trying to get system information of a local computer.But i new in win32.
Thanx
|
|
|
|
|
|
Hi all,
I recently was helped out here and given a pointer to use Createfile/Readfile/Writefile for my direct disk access in a bit of code I'm working on...
Unfortunately, while it seems fairly straightforward, I'm having a few difficulties.
The following is my code (with all error checking and other superfluous bits removed, just for clarity - but they are really there!).
I can't for the life of me figure out why this doesn't work. It should simply:
1 - Open the A drive for reading (this does seem to happen)
2 - Open c:\file.img for writing (this does seem to happen)
3 - Read 256bytes from the A drive in to a buffer (actually only doing 256bytes during testing... what I really want it to do is get the size of the disk using GetDiskFreeSpaceEx, then use that as the size to read/write so it does the whole disk)
4 - Write these 256bytes back to c:\file.img
What ends up happening is that I get 256bytes of what appears to be random garbage written in to the file... so it's writing, but WHAT it's writing and where it's getting it from I have no idea...
It's likely the problem lies in a fundamental failure to understand how this process is supposed to work. Therefore, this is probably something insanely simple and I'm going to feel like a complete moron, but as a relative beginner in C++ (despite the scary concept that I now do it "officially" for work) I think I'm entitled to be a moron on rare occasions
<br />
HANDLE hDriveRead;<br />
hDriveRead = CreateFile(TEXT("\\\\.\\a:"), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);<br />
<br />
HANDLE hFileWrite;<br />
<br />
hFileWrite = CreateFile(TEXT("c:\\file.img"), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);<br />
<br />
DWORD dwImageBuffer[256];<br />
DWORD nBytesToCopy=256;<br />
DWORD nBytesRead;<br />
DWORD nBytesWritten;<br />
ReadFile(hDriveRead, dwImageBuffer, nBytesToCopy, &nBytesRead, NULL);<br />
WriteFile(hFileWrite, dwImageBuffer, nBytesToCopy, &nBytesWritten, NULL);<br />
<br />
CloseHandle(hFileWrite);<br />
CloseHandle(hDriveRead);<br />
Any help would be greatly appreciated.
|
|
|
|
|
YttriumOxide wrote:
What ends up happening is that I get 256bytes of what appears to be random garbage written in to the file
What are you expecting to see in the image file? The first sector (512 bytes) of the disk is the boot sector, which has mostly machine language code.
--Mike--
LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
I'm aware of that... but what I'm getting really is garbage - not the first 256bytes of the disk (which as you quite rightly point out is the first 256bytes of the bootsector).
|
|
|
|
|
Hi,
I've subclassed CComboBox. I've setup the background and text colours called Invalidate(). Which works perfectly well with the edit box. It's when I dropdown it's crashing the app. I want to able to change the colour of the listbox part as well.
Here's the code snippet:
<br />
BEGIN_MESSAGE_MAP(CComboEx, CComboBox)<br />
ON_WM_CTLCOLOR_REFLECT()<br />
ON_WM_CTLCOLOR()<br />
END_MESSAGE_MAP()<br />
<br />
<br />
HBRUSH CComboEx::CtlColor(CDC* pDC, UINT nCtlColor) <br />
{<br />
<br />
<br />
pDC->SetTextColor(m_Text);<br />
pDC->SetBkColor(m_Background);<br />
pDC->SetBkMode(TRANSPARENT);<br />
m_brush.DeleteObject();<br />
m_brush.CreateSolidBrush(m_Background);<br />
return m_brush;<br />
}<br />
<br />
HBRUSH CComboEx::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) <br />
{<br />
HBRUSH hbr = CComboBox::OnCtlColor(pDC, pWnd, nCtlColor);<br />
<br />
return hbr;<br />
}<br />
<br />
Thanks in advance,
Alton
|
|
|
|
|
I need some help with the function CRecentFileList::GetDisplayName.
How did I get the full Path back from this function?
Although the full Path is stored in the Registry I always retrieve the shortened Path like
"D:\MyProgramm\DirLevel1\...\DirLevel4".
Could someone give me a hint on that please?
Thanks
|
|
|
|
|
|
Thanks ravi.
That was a really good hint.
Now I use
csDir = (*m_pRecentFileList)[nMRUIndex];
instead of my first try
m_pRecentFileList->GetDisplayName(csDir,nMRUIndex,"",0,true);
and it works fine.
|
|
|
|
|
By now I can generate some dib bitmap in a MDI application dynamic, so there are many bitmap in a view.In one hand,I need to manipulate these bitmap by the mouse, for example, drag a bitmap to somewhere else, or enlarge a bitmap by drag a bitmap's edge and so on.Another hand, I also need to manipulate these bitmap in while,such as printing the whole view.
What should do?
I think I need define a new view class or control which can contain and display one bitmap.then I only need the manipulate the view class or control.
andy
|
|
|
|
|
|
thank you, Selvam.
andy
|
|
|
|
|
How do I make my dialog box initially visible with MFC?
|
|
|
|
|
say detailedly .
CDialog dlg;
dlg.DoModal() ??
|
|
|
|
|
I had tried that. Actually I want to use the dialog box as a toolbar, that is why i want it visible. I have .cpp and .h files for the toolbar class derived from CDialog. I included the .h file in MainFrm.cpp. I also have CToolBarNew m_wndToolBarNew; in the protected section ofCMainFrame class. But it still gives compiler error: missing storage-class or type specifiers
|
|
|
|
|
Kapgan wrote:
I included the .h file in MainFrm.cpp.
Put it in the MainFrm.h file.
Why aren't you extending CToolBar?
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
- -Uknown.
|
|
|
|
|
What is the simplest way to create a socket for UDP transfer
|
|
|
|
|
The "simplest" way is to search codeproject instead of asking here!
Don't try it, just do it!
|
|
|
|