|
I have never done this but here's a thought... Use
CWnd* myWnd = CWnd::FindWindow(NULL, _T("Paint2"));
myWnd->PostMessage(..) and send all the mouse movement messages that you receive to the other window. It may work, it may not.
|
|
|
|
|
Thats what I said I did and but it doesn't work.
If I just filter out mousemove, lbuttonup and lbuttondown and postmessage those, VC spy says the destination paint is getting them but nothing draws on the paint area. If I send all mouse events then the detination paint just hangs up.
I'm stuck.
Regards,
Zee Man
|
|
|
|
|
Hi all
I have the follow problem.
In a mixed program i am using manage code to access webservices i cannot load an HIMAGELIST.
The program is written with no MFC or ATL/WTL. It is just plain win32.
When i call the ImageList_LoadImage(..) i got the follow error
"
An unhandled exception of type 'System.TypeLoadException' occurred in Emporio.exe
Additional information: Could not load type _IMAGELIST from assembly Emporio, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
"
If i compile the program with out CLR it works fine.
Thanks in advance for any help.
George
|
|
|
|
|
I managed to eliminate the problem compiling the specific cpp file without "Assembly Support /clr". Of course this is not a solution.
I have another file with a database grid which must be combiled with /clr support.
George
|
|
|
|
|
Supposed a usb disk has 3 partitions. Then how to get the volumes letters after my application run?
Sample code or article is preferred. Thanks.
|
|
|
|
|
I copied this from a library routine I wrote to illustrate the technique. In my case I was only looking for fixed drives where I think you would be looking for removable drives. I am not sure, since it was a long time ago when I wrote the code, but I think I remember the USB drives coming up as removable. You will have to determine that for yourself as I am not 100% sure.
DRIVE_UNKNOWN The drive type cannot be determined.
DRIVE_NO_ROOT_DIR The root path is invalid. For example, no volume is mounted at the path.
DRIVE_REMOVABLE The disk can be removed from the drive.
DRIVE_FIXED The disk cannot be removed from the drive.
DRIVE_REMOTE The drive is a remote (network) drive.
DRIVE_CDROM The drive is a CD-ROM drive.
DRIVE_RAMDISK The drive is a RAM disk.
You may want to start at iDrive = 2 and MAX_DISKS = 24 to bypass the A: and B: drives which are removable but usually floppy disks.
Then again for completeness you may want to interrogate the A: and B: drives to determine by some other means if the A: and B: drives are floppy or USB drives.
I don't know if you are targeting clients capable of sophisticated configurations or the run of the mill PC that was assembled when bought and whose configuration has not been modified.
You can change the countof, a macro used to get the max count of characters in a TCHAR array, to sizeof if you also change the TCHAR to char in the _DRIVES structure.
You may not want to generate an stl::vector so you may have to cut and paste into your code.
// STL includes
#include <vector>
#include <algorithm>
using namespace std;
#include <tchar.h>
#include <strstrea.h>
#ifndef __COUNT_OF__
#define __COUNT_OF__
#define countof(x) (sizeof(x)/sizeof((x)[0]))
#endif // #ifndef __COUNT_OF__
#ifndef _DRIVES_
#define _DRIVES_
typedef struct _DRIVES{
TCHAR szDrive[4];
TCHAR szLabel[64];
}DRIVES;
#endif // #ifdef _DRIVES_
#define MAX_DISKS 26
char DiskLetters[MAX_DISKS][4]={
"A:\\", "B:\\", "C:\\", "D:\\", "E:\\", "F:\\",
"G:\\", "H:\\", "I:\\", "J:\\", "K:\\", "L:\\",
"M:\\", "N:\\", "O:\\", "P:\\", "Q:\\", "R:\\",
"S:\\", "T:\\", "U:\\", "V:\\", "W:\\", "X:\\",
"Y:\\", "Z:\\"
};
int CUtil::AcquireDiskPartitions(vector<DRIVES>& vDrives){
int iDrives = 0;
char szVolumeName[128] ;
char szFileSystem[48];
DWORD dwVolumeSerialNumber = 0;
DWORD dwMaxFileName = 0;
DWORD dwFileSystem = 0;
DRIVES drvItem;
ostrstream strmDrive(drvItem.szDrive, countof(drvItem.szDrive));
ostrstream strmLabel(drvItem.szLabel, countof(drvItem.szLabel));
vDrives.clear();
for (int iDrive = 0; iDrive < MAX_DISKS; iDrive++){
if (GetDriveType(DiskLetters[iDrive]) == DRIVE_FIXED){
GetVolumeInformation(DiskLetters[iDrive],
szVolumeName,
sizeof(szVolumeName),
&dwVolumeSerialNumber,
&dwMaxFileName,
&dwFileSystem,
szFileSystem,
sizeof(szFileSystem));
strmDrive.seekp(0);
strmDrive << DiskLetters[iDrive] << ends;
strmLabel.seekp(0);
strmLabel << szVolumeName << ends;
vDrives.push_back(drvItem);
iDrives++;
}
}
return iDrives;
}
|
|
|
|
|
Hello
Recetnly, I use function ExtEscape at my program,
but I don't know what should be referred to the parameter nEscape.
What value should be referred to the parameter nEscape?
Could you discribe this in detail for me?
Thanks!
int ExtEscape(
HDC hdc,
int nEscape,
int cbInput,
LPCSTR lpszInData,
in cbOutput,
LPSTR lpszOutData
);
free like a bird
|
|
|
|
|
Have a look @ msdn. It is nicely documented there. But except three all the others will work with XP/2000
|
|
|
|
|
Is the build utility in IDE the same as nmake in command-line?
Are they the same thing? Like when using build
utility in IDE, I'm actually using the nmake.exe?
Need help understand the MAKE utility in VS.Net,
would you mind explaining it a bit?
Thanks
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
No, but it's similar.
If all you want to do is build an application from the command line you have a few options. nmake is one of them, but unless you are familiar with makefiles from another environment it probably isn't worth your while learning them (I find it much easier to let visual studio do it)
Before running NAnt (AFAIK) or devenv from the command line you will need to run vsvars32.bat
NAnt is a command line build system which uses XML, it's nice for C# but it still looks like a hassle for C++ which has so many compiler options. It is doable however
NAnt[^]
NAnt with C++[^]
More NAnt C++ Stuff[^]
What I've found is easier is to use the IDE to build your code from the command-line. This is the only officially sanctioned MS way of doing things at the moment, and it looks like being that way for a while (MSBuild the command line build system for VS.NET 2005 won't support C++). One thing Microsoft don't tell you is that this won't work for solutions or projects with spaces in the names (not the folders, just the actual files).
devenv /build debug "c:\MySolutions\VStudioProjects\MySolution\MySolution.sln"
VS.NET from the command line[^]
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts your aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Does anyone have any sample applications developed in VC++ for a standard text editor with features like syntax highlighting, other editing options like Search - Find/Replace/Goto, Editing options - Cut/copy paste, SelectALL/clear etc.
Also what are teh general features one would provide in a standard text editor.
|
|
|
|
|
My Visual Studio.Net 2003 is installed at E:\VS.Net 03
Now I'm in command-line prompt, using the cl compiler:
E:\VS .NET 03\Vc7\bin> cl /?
I got this error message: This application failed to start
because mspdb71.dll was not found.
But when I'm in IDE, I can compile and run any source with
no problem.
How do I use the VS.Net 03 in command-line environment?
Thanks
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
I think the problem is the with the path and the environment variables setting. i don't know how this can be done in .net but in vc++ we can do it by calling a bat fie Vcvars32.bat
|
|
|
|
|
I have Microsoft Windows XP DDK and the Microsoft Visual C++ compiler. When I try to compile a driver I get an error: compiler version not supported by the DDK. what should I do to be able to compile a driver with my compiler?
gabby
|
|
|
|
|
|
Hello,
I have written a COM addin in C++. I face a challenge of needing to send a message (much like pWnd->PostMessage(...) in CWnd) in the COM add in environment. Any way of achieving such effect?
thanks.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hello,
How to enable and disable a device driver by using VC++ or BC++?
Could anyone can give me the sample code to enable and disable a driver such as netcard or audio card?
Thanks.
Joye
|
|
|
|
|
|
I have an INI file that contains following:
[CONG]
COL1;COL2;COL3;COL4
COL11;COL22:COL33;COL44
COL111;COL222;COL333;COL444
How can I read and populate a combobox or listbox as follows:
COL1
COL11
COL111
then when I select an item (COL1 for example) from the list, it will read the forth item in the INI
COL4
Any guidelines, direction or sample code will be greatly appreciated
|
|
|
|
|
forgot to mention using VC++6 with/without MFC
|
|
|
|
|
just tokenize it by using strtok, bear in mind however there are some issues on strtok. (check the MSDN)
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Why do you use .Ini file?
get the value into CString;
Find where are the ';', with CString.Find(";",0);
Get the string with CString.Mid
<italic>Work hard and a bit of luck is the key to success.
|
|
|
|
|
use the fgets() function to read each complete line into an array of char (or CString or whatever you use), then just trawl through it until you find a ';' character and set it to 0 or '\0'. Once you've done that add it the combo box and read in the next line...
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
Hello there,
I want to use a functionpointer to ReadFile and WriteFile in my program, but for some reason the code won^t compile correct. This is how I declare the function pointer:
BOOL (*pReadFile)(HANDLE , LPVOID , DWORD , LPDWORD , LPOVERLAPPED ); <br />
<br />
pReadFile = &ReadFile;
The compiler complains about:
error C2440: '=' : cannot convert from 'int (__stdcall *)(void *,void *,unsigned long,unsigned long *,struct _OVERLAPPED *)' to 'int (__cdecl *)(void *,void *,unsigned
so problem seems to be the __stdcall and __cdecl declarators.. Anyone knows how I should declare my function pointer in order for this to work???
Thanks for any advice,
Davy
|
|
|
|
|
ok , just placed the answer in my question myself it seems...`
I had allready tried to add the __stdcall in my pointer declaration, but put it after the *..
Answer to my question is:
declare pReadFile as:
BOOL (__stdcall*pReadFile)(HANDLE /*hFile*/, LPVOID /*lpBuffer*/, DWORD /*nNumberOfBytesToRead*/, LPDWORD /*lpNumberOfBytesRead*/, LPOVERLAPPED /*lpOverlapped*/);
But it would be nice if anyone might be able to tell me where that __cdecl and __stdcall come from...
Thx..
Davy
|
|
|
|
|