|
ANDYFA wrote:
i want to send MSG in the MFC
Do you mean SendMessage() ?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
|
Ok, what exactly did you want to know about message maps in MFC, aside from the framework using them to connect messages and commands to their handler functions.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
i made a window(dia) with no title bar so i want to move it around when i click on it
|
|
|
|
|
It helps to be specific the first time around.
See here for an example.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi,
By entering characters in the edit box should be sent to the port.Now from the port i need to read the data character by character and display it in another edit box for each click of the ctrl buttton.
how am i to do it?
Pls help.
Mithuna
|
|
|
|
|
I want to create a new Excel file and create all the tables in it using the ODBC.
e.g. Creating the file Student.xls, then creating tables ID and Name.
I am using MFC with Visual Studio 6.
modified 9-Mar-17 17:25pm.
|
|
|
|
|
Congratulations on your desire to learn about manipulating Excel files via C++. What exactly are you having trouble with? What code have you put together thus far?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Dear Friends,
I would like to restart a PC whenever any error occurs in my application.
How can I do so. Please help me as soon as possible.
Thanking You in advance.......
Billar
|
|
|
|
|
ExitWindowsEx()
There is no spoon.
mail
|
|
|
|
|
If you are using NT/2000/XP, you will need to set privileges.
DWORD dwVersion = GetVersion();
if ( dwVersion < 0x80000000)
{
HANDLE hToken;
LUID tmpLuid;
HANDLE handleProcess=GetCurrentProcess();
if (!OpenProcessToken(handleProcess,TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
return;
if (!LookupPrivilegeValue(0,"SeShutdownPrivilege", &tmpLuid))
return;
TOKEN_PRIVILEGES NewState;
LUID_AND_ATTRIBUTES luidattr;
NewState.PrivilegeCount = 1;
luidattr.Luid=tmpLuid;
luidattr.Attributes=SE_PRIVILEGE_ENABLED;
NewState.Privileges[0]=luidattr;
if (!AdjustTokenPrivileges(hToken, false, &NewState, sizeof(TOKEN_PRIVILEGES), 0, 0))
return;
}
ExitWindowsEx(...);
|
|
|
|
|
Thanks u very much for your important advice.....
Billar
|
|
|
|
|
Billar wrote:
I would like to restart a PC whenever any error occurs in my application.
This is a very bad design in my opinion. Since there is no way you are going to develop an error-free application, I certainly would not want my PC restarting while I am in the middle of something important (e.g., typing research paper, presentation to the board). Do you concur?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Dear David,
You r absolutely right. There will never be a solution by restarting the system instead of solving the particular error, when have errors.
Actually my requirement was to restart the system on a certain condition.
Billar
|
|
|
|
|
I have 2 MS paintbrush applications side by side. I want to duplicate the brush strokes of one paintbrush on the other. I do this by installing a dll WH_GETMESSAGE hook on the 1st paintbrush and detect WM_MOUSEMOVE and LBUTTONUP/DOWN events.
But how to duplicate it on the 2nd paint app? If i do setCursorPos the mouse moves away from the control of the artist. And sending a PostMessage(WM_MOUSEMOVE,x,y) to the 2nd paint doesn't seem to work.
Is there any way to simulate a mouse move without taking the mouse away from the user?
Need Help.
thanks.
Regards,
Zee man
|
|
|
|
|
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
|
|
|
|