|
thank you
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
James R. Twine wrote: the standard MB_OK message box's OK button is really a Cancel button behind the scenes - that is why you can use the [X] button or the <esc> key to dismiss it.
James, do you really mean that? I don't get it. What am I missing?
AFAIK, When you do not specify a cancel button, that is when you use a style like MB_YESNO, the 'X' button will be disabled and pressing the Esc key will not dismiss the message box!
|
|
|
|
|
I am talking about a message box with a single [OK] button (the MB_OK style bit). If the dialog is showing anything other than the single [OK] button, then the buttons are as you would expect.
The MB_OK style of message box shows a single [OK] button, but it is actually an IDCANCEL button behind the scenes that just has the text of "OK" on it (or its equivalent). Since it is an IDCANCEL button, the [X] remains enabled and can be used to dismiss the dialog, just like pressing <ESC> . (Generally, if you have a dialog that has a button on it with IDCANCEL , pressing the [X] or <ESC> usually activates it.)
When you use other styles that exclude the CANCEL style, like MB_YESNO , there is no IDCANCEL button present, so the [X] is disabled and/or has no effect, just like with pressing <ESC> .
(The things you learn having to install windows hooks to intercept and scrape dialog boxes and then determine which button to simulate activation of in order to dismiss it... Gotta love having to shoehorn GUI-laden code into a server!)
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
brahmma wrote: What am I missing?
Spy++.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Am I wrong here ?
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
James R. Twine wrote: N.B. the standard MB_OK message box's OK button is really a Cancel button behind the scenes - that is why you can use the [X] button or the <esc> key to dismiss it.
In a normal message box with only the MB_OK style enabled, the [X] or pressing the <ESC> key too returns IDOK from the message box call, which is equivalent to pressing the OK button. I do not find it to act like a cancel button behind the scenes or any such thing.
See it for yourself:
DWORD dwRetValue = MessageBox("Hi there","Hello",MB_OK);
switch(dwRetValue)
{
case IDCANCEL:
AfxMessageBox("Cancel was selected");
break;
case IDOK:
AfxMessageBox("OK was selected");
break;
}
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
Use MB_YESNOCANCEL instead of MB_YESNO
|
|
|
|
|
Hi all.
<br />
try<br />
{<br />
m_File = freopen(FileName,"rb",stdin);<br />
}<br />
catch(...)<br />
{<br />
m_nErrMsg = GetLastError();<br />
<br />
strcpy(m_sErrMsg,"ERROR:Cant Open File");<br />
<br />
return 1;<br />
}<br />
<br />
strcpy(m_Name,MyFile(FileName));<br />
strcpy(m_FullName,FileName);<br />
<br />
<br />
cin>>m_Bit00;
cin>>m_ModiperData; <br />
cin>>m_RecNum; <br />
cin>>m_HeadBitNum; <br />
cin>>m_RowBitNum; <br />
cin>>m_Resved; <br />
cin>>m_Transsaction; <br />
cin>>m_EncDenc; <br />
cin>>m_MultiUser[0]; <br />
cin>>m_MultiUser[1]; <br />
cin>>m_MultiUser[2]; <br />
cin>>m_ProductionIndex;<br />
cin>>m_LanguageID; <br />
cin>>m_ResFill; <br />
in this code I try to open MyDBF.dbf file
and read head of it, but afret reading m_Bit00 "cin" function dont read
others, it means if 'm_RecNum' wos -1 aftera reading it will -1 or if it wos 0 after reading it will 0 too.
can healp.
|
|
|
|
|
The freopen(...) function will not raise exceptions to report general failures, as it is a C-RTL function, not a C++-designed one; it will return NULL and close the specified file if something goes wrong.
If m_sErrMsg is a string object, it is likely that strcpy(...) to copy into it is a very bad idea.
The layout of your data file is not documented here, so we cannot tell if you are using the wrong types with the stream or not. If the layout is static/fixed, as it appears from your code snippet, there is no reason why you cannot fread(...) this data into a struct . It would likely be faster than using the stream operators multiple times on separate data items.
Lastly, cin is likely not your data file unless you have redirected the file into the application's standard input.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
hi
i want to know is there a way to execute an exe file in memory without extracting it to hard disk. i have created sfx which extracts the compressed file to the disk. i can extract file to memory but i don't know how to execute that in memory.
any idea??
|
|
|
|
|
near2world wrote: i want to know is there a way to execute an exe file in memory without extracting it to hard disk.
None that I've ever been able to find. That's not to say that one does not exist, however.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I don't know if this is impossible, but several time ago you could generate a virtual hard disk in the RAM area. would'nt this be a kind of solution? (I can't remember the instruction).
And in antoher hand, would'nt it be possible to use any of the libraries that exist in order to interact with zip,rar... and try to modify them in order to achieve that?
PS: I've never done that before, only thinking on those two possibilities...
|
|
|
|
|
actually i am writing a program that will protect an exe by attaching it to sfx. now when this sfx is launched it will ask password, if pass is correct sfx extracts the exe and executes.
now sfx can extract file to hard disk and launch it.very straight and very simple. but what if a user points out the extracted exe and copies it then the whole purpose is simply defeated.
i am struck what to do.
|
|
|
|
|
near2world wrote: but what if a user points out the extracted exe and copies it then the whole purpose is simply defeated.
True, but there are workarounds for this.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Just code your program to expect a command-line argument. When you run your program from inside of another, you would supply said argument. Those that save your program to try and run elsewhere would not know that it required a command-line argument nor what it should be. Make sense?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
this looks like an alternative solution to the problem.
thnx a lot.
|
|
|
|
|
uufff... as you know there are programs that decode the passwords for compressed files... moreover, surely there are lots of ways to get access to that exe while it is loaded...
I don't know, let's see if somebody can help you... I can't...
|
|
|
|
|
Hello everybody!
my thread application gets hang. can anybody help me welcome for sharing the code.
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Can you explain more?
Cheers,
Suresh
|
|
|
|
|
sure dear !
actually i have been waiting for anybody's replay.thanks
well I have made list view in that list view there are suppose some files. I have started the batch mode protection . I have to use threading for that.
how can I do?
the code is below.
hwndListbox=hList;
LRESULT ListBoxItemCount=ListView_GetItemCount(hwndListbox);
int iSelectedFile1=ListView_GetSelectedCount(hwndListbox);
int iSelectedFile=SendMessage(hList,LVM_GETNEXTITEM,-1,LVNI_SELECTED);
if(ListBoxItemCount > 0)
{
for(int i=0;i<ListBoxItemCount;i++)
{
ListView_GetItemText(hwndListbox,i,1,(LPWSTR)&szBuffer,MAX_PATH);
ListView_GetItemText(hwndListbox,i,3,(LPWSTR)&szBuffer2,MAX_PATH);
string inputFile2= util.ConvertWCHARToString(szBuffer2);
string filenamewithpath = util.ConvertWCHARToString(szBuffer);
string inputFile=inputFile2+"\\"+filenamewithpath;
MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,inputFile.c_str(),(int)(inputFile.length() + 1),bufferwithpath,MAX_PATH);
UINT Iselected=ListView_GetSelectedCount(hList);
unsigned threadID;
Utility util;
string outputfile=PrepareOutputFile(hDlg,util.ConvertWCHARToString(bufferwithpath));
WCHAR w_Output[MAX_PATH];
MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,outputfile.c_str(),(int)(outputfile.length() + 1),w_Output,MAX_PATH);
struct argument_list l;
l.pszInFile=bufferwithpath;
l.pszOutFil=w_Output;
l._ProtectSet=_ProtectSet;
l.hList=hList;
l.Host=HOST;
l.hwndEncrypt=hwndEncrypt;
l.hWndinoutfiledir=hWndinoutfiledir;
l.hwndParent=hDlg;
l.InitPackageRequest=sINIT_PACKAGE_RESPONSE;
l.Port=PORT;
l.ScriptFile=COMMUNICATOR_SCRIPT_FILE_PATH;
l.UserID=UserID;
<big>hThread=(HANDLE)_beginthreadex(NULL, 0, &Thread ,&l,NULL, 0);</big>
}
WaitForSingleObject( hThread, INFINITE );
unsigned __stdcall Thread(void* pArguments )
{
HRESULT hr;
struct argument_list *Lparam= (argument_list *)pArguments ;
Package pkg;
<big>hr=pkg.EncodeMediaContent(Lparam->pszInFile,Lparam->pszOutFil,Lparam->hwndParent,Lparam->Host,Lparam->UserID,Lparam->InitPackageRequest,Lparam->ScriptFile,Lparam->Port,Lparam->hList,Lparam->_ProtectSet,Lparam->hWndinoutfiledir,Lparam->hwndEncrypt); </big>
if(hr==S_OK)
{
MessageBox(0,L"thread gone finished" ,L"therad",0);
_endthreadex( 0 );
}
return 0;
}
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Why use a separate thread if you are just going to wait for it to finish?
If it's hanging then you can break execution in the debugger and examine the call stack(s)
to see where it's hanging.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I got your code (email) and right away I noticed your struct argument_list l; variable that
you are passing to your thread isn't static or global so it goes out of scope while the thread is
running. That's a big problem
Instead of making it global, maybe allocate the object with new and pass the pointer to the
thread. The thread can delete it when it's done with it or the thread can notify the calling
thread somehow and let the calling thread delete it - whatever works best for your application.
I'll let you know if I find anything else.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I just got an email saying I have responded to myself here[^]
That message was meant for you.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hello,
I've made a function that uses a BSTR, and returns it type casted as a CString.
Something like that:
CString Myfunc()<br />
{<br />
BSTR a;<br />
somefunc(&a);<br />
return (CString)a;<br />
}
And then I use that in order to set the returned CString as the text of a CEdit:
CEdit B;<br />
B.SetwindowtextA(MyFunc());
Is there any way that this could be generating a memory leak?
As always thank you in advance.
|
|
|
|