|
If this code actually works... it will only work in DOS. I don't have a DOS box here in my office so I cannot test it.
void RebootWithoutAsm(bool bWarm)
{
int iWarm = true == bWarm ? 0x1234 : 0;
void ((*Reboot)())=(void(*)())((0x0040L << 16) | 0x0072L);
*(int*)((0x0040L << 16) | 0x0072L) = iWarm;
(*Reboot)();
}
Best wishes,
-David Delaune
|
|
|
|
|
Hi, i wonder if there is a method to get more informations about the inside of a template. For example
template<typename databasetype="">
int OKDatabaseFile<databasetype>::OpenDatabase ....
Inside this function OpenDatabase, i have the template DATABASETYPE. I can get the size of this template with "sizeof", still i want more. I want the number of variables inside the DATABASETYPE struct, i want the names of the variables, the datatypes.
Is that possible?
|
|
|
|
|
HorrorVision wrote: i want the names of the variables, the datatypes.
Is that possible?
no. C++ doesn't have any such capability.
|
|
|
|
|
Hi buddy!
Can you tell me how to change writing direction in an edit box (MFC) from right/left to left/right please?
I mean at RUN TIME...
modified on Monday, March 17, 2008 12:19 PM
|
|
|
|
|
Does the WS_EX_RTLREADING style work for you? It can be set at design time as well as run-time.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I have 3 USB ports on my PC. I am using one for my keyboard and other is connected to a mouse and the 3rd one is free.
But the device manager of my PC shows 5 USB Universal Host controllers 27C8,27C9,27CA,27CB & 27CC.
I will be connecting a controller board to the free USB port. I need to use CreateFile(), ReadFile() and WriteFile() to read and write to the USB port.
Now how do I identify the free port?
|
|
|
|
|
You don't access the USB port the same way you access a serial port (so, you don't specify the "port name" to the CreateFile function). Instead you get a handle to a device driver which will communicate with the USB device. So, you need to give the identification of this driver to the CreateFile function. This is of course totally dependant of which USB device you are trying to communicate with. Normally, this should be described in the documentation of the controller board.
|
|
|
|
|
I defined a data type in a base calss .h file , not in the calss and all the dreived classes are flash the below error, Any advice pls.... I need this enum to be access to all the dlg class
error LNK2005: "enum ABC @@A) already defined in kkk.obj
And also the below warining
warning LNK4006:
|
|
|
|
|
add a #pragma once at the beginning of your .h file...
|
|
|
|
|
|
ptr_Electron wrote: error LNK2005: "enum ABC @@A) already defined in kkk.obj
See here.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Inside the code i need to convert the LPCWSTR to char[] ,anybody have a clue???
//
// Print the name of the user account.
//
wprintf(L"\t-- %s\n", pTmpBuf->usri3_name);
printf("\n equlilent string is [%s]\n ",(char*)pTmpBuf->usri3_name);
// here i get only single char
vineesh
modified on Thursday, March 5, 2009 4:28 AM
|
|
|
|
|
Please click on the "edit" link in your post, remove EVERYTHING and ask a specific question with "relevant" source code, if any.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
vineeshV wrote: wprintf(L"\t-- %s\n", pTmpBuf->usri3_name);
printf("\n equlilent string is [%s]\n ",(char*)pTmpBuf->usri3_name);
a simple cast is not enough, you need a string conversion, for instance using WideCharToMultiByte , see this sample.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
vineeshV wrote: wprintf(L"\t-- %s\n", pTmpBuf->usri3_name);
printf("\n equlilent string is [%s]\n ",(char*)pTmpBuf->usri3_name);
Have you tried:
printf("\n equivalent string is [%S]\n ",(char*)pTmpBuf->usri3_name); They don't necessarily hurt anything, but you might also consider removing those unnecessary #include statements.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
int iSize = WideCharToMultiByte(CP_ACP,0,pTmpBuf->usri3_name, -1, NULL, 0, NULL, NULL );
char* lpNarrow = new char[iSize];
lpNarrow[0] = 0;
iSize= WideCharToMultiByte(CP_ACP, 0,pTmpBuf->usri3_name, -1, lpNarrow, iSize, NULL, NULL );
printf("\n equlilent string is [%s]\n ",lpNarrow);
delete [] lpNarrow;
printf("\n equlilent string is [%S]\n ",pTmpBuf->usri3_name);
best wishes,
-David Delaune
|
|
|
|
|
Thanks David,
it really works for me ...
The beer is for you !!!!!!!!
vineesh
|
|
|
|
|
Hi,
I developed an application in MFC dialog,
where i am printing the Html page using ExecWB command.
The problem is, initially my application memory consumption is low.
But when i call print command (ExecWB) the memory usage rises
tremendously.
But for further execution of command its stable..!!
I am not getting whats the exact problem is..??
Plz help me in this regard..
Thanx in advance.
Reagards
Shiva
|
|
|
|
|
Maybe it's something internal to the ExecWB() function.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Do u have any idea or solution how to overcome this problem..?
Reagards
Shiva
|
|
|
|
|
void CWebBrowser2::ExecWB(long cmdID, long cmdexecopt, VARIANT* pvaIn, VARIANT* pvaOut)
{
static BYTE parms[] =
VTS_I4 VTS_I4 VTS_PVARIANT VTS_PVARIANT;
InvokeHelper(0x1f6, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
cmdID, cmdexecopt, pvaIn, pvaOut);
}
Actually its internally calling 'InvokeHelper' which may b using some
stack..
Reagards
Shiva
|
|
|
|
|
Can you show us what ExecWB() is doing?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
someobj.ExecWB(OLECMDID_PRINT, 0 , NULL, NULL);
I used MS-WebBrowser ocx(CWebBrowser2)
Reagards
Shiva
|
|
|
|
|
Whoops! I thought you had a different ExecWB() in your own namespace and asked for that code. I think agree with what David has said above.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I don't see any problem there.
Don't you like such a behaviour?
BTW What is ExecWB ?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|