|
None of them are standard C++, because they either won't compile, or you included iostream.h, which is not part of standard C++. Inclide iostream instead, and put using std::cout;, etc. for the bits you want to use.
Also, void main is not valid C++, main must return int.
I doubt any of them is more efficient in any real terms.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
|
|
|
|
|
dear all,
how can i get the Last Modification Date Of any File (Not the Creation date) using API.
thanx
|
|
|
|
|
Easy one! : take a look at
BResultGetFileTime = GetFileTime(hFile,&ftCreacio,&ftDarrerAcces,&ftLastModification);
Hope this helps...
|
|
|
|
|
You can use the CFileStatus class along with CFile::GetStatus function to get the modified time. CFileStatus class contains a CTime member m_mtime.
|
|
|
|
|
Is it possible to built an EXE File With Exports? Forget about COM server Exes...
Vikrams
|
|
|
|
|
Yes it is quite possible to export functions from an exe as we export from a dll. You can add global function in your exe and use the extern "C" _declspce(dllexport) with the function declaration.
use loadLibrary and GetProcAddress to load this exe and call the exported function in it. Don't forget the declare the function before using it by using the keyword _declspec(dllimport).
|
|
|
|
|
I declared one funcion into my win32 EXE as
extern "C" __declspec(dllexport) void Function(void){
MessageBox(NULL,"","",MB_OK);
}
and user in other win32 EXE as
typedef void (*FUNCTION)();
FUNCTION Function=NULL;
HINSTANCE MyInstance=LoadLibrary ("c:\\ExeFile.exe");
if(MyInstance){
Function=(FUNCTION)GetProcAddress(MyInstance,"Function");
if (Function)
{
Function();
}
But It Gives me access violation Error...
Vikramvs
|
|
|
|
|
Instead of the MessageBox, if you return some value, it will work. So, based on this return value you can display the message box in your application.
|
|
|
|
|
I would like to invoke help file of my application when F1 is pressed by user. System is trying to open Windows Help when i press F1 Any suggesstions.
With Thanks & Regards
--Kamesh
|
|
|
|
|
Add message map for the command ID ID_HELP in your application.
Like, ON_COMMAND(ID_HELP, OnMyHelpFun). Inside OnMyHelpFun, you can add code for invoking the help file.
|
|
|
|
|
Thanks for your reply i will do as u suggesst.
|
|
|
|
|
Hi,All
In my application,
i have to convert 32bit number to 4bytes(i.e each byte having 8bits).
can any one help me..
thanks in advance
regrads
anju
|
|
|
|
|
int x = 0x01020304 ;
const unsigned char* p = (unsigned char*) &x ;
for ( int i=0 ; i < 4 ; ++i )
cout << p[i] << endl ;
You should save yourself and your company years of grief by shooting yourself through the head immediately. Believe me, in the long run it'll turn out better for everyone. - Tyto (at arstechnica)
Awasu 1.0[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
unsigned int i = 0x11223344;
BYTE *pb = (BYTE *)&i;
TRACE("%d, %d, %d, %d", pb[0], pb[1], pb[2], pb[3]);
When history comes, it always takes you by surprise.
|
|
|
|
|
int x = 0xfc12a15d;
char c[4];
for (int y = 0; y < 4; ++y)
c[y] = (x & (0xff << (y * 8))) >> (y * 8);
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Hi,
Thanks for every one
contributed inthis context.
now my task is simple with your sugestions.
once again thanks to all.
anju
|
|
|
|
|
I have a dll ( a Palm conduit actually ) and I'd like to know the path to the dll from within the dll in dllmain. Does anyone know how this can be done ?
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
|
|
|
|
|
Shame on me, the answer was in the FAQ...
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
|
|
|
|
|
Just to clarify the FAQ (since it deals with an EXE, not a DLL), DllMain() is passed the HMODULE of the DLL. Pass that handle to GetModuleFileName() .
If you pass NULL to GetModuleFileName() , you'll get the path of the EXE that loaded your DLL, which isn't what you're looking for.
--Mike--
PROCRASTINATION: Hard work often pays off after time, but laziness always pays off now.
BUY MY SOFTWARE!! (please?) RightClick-Encrypt | 1ClickPicGrabber
My IntarWeb Homepgae!!!11
|
|
|
|
|
i'm not really sure so don't quote me but i vaguely remember trying to do this years ago.
::GetModuleHandle
or maybe these which are in PSAPI
::EnumProcessModules
::GetModuleInformation
::GetModuleFileNameEx
|
|
|
|
|
Hi, all
How do you get the exact width and height (even if the user has increased or decreased the DPI settings) of a single-font multi-line text without drawing it? Do you use GetCharWidth32 for this process or are there better ways? Could you please demonstrate this process in code please =)
Aidman » over and out
|
|
|
|
|
CDC::GetTextExtent or DrawTextEx with the DT_CALCRECT flag
-c
When history comes, it always takes you by surprise.
|
|
|
|
|
Great thanks!
Aidman » over and out
|
|
|
|
|
I want to use some functions exported from a dll, but I don't have the documentation or the header file. I can get the names of the exported functions by using dumpbin, but how do I determine the function parameters?
|
|
|
|
|
Guess...
That's the only way
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|