|
oh, i see another problem...
each header file must be "included" once into the project. for that, you must use preprocessor directive to exclude recursive redifinitions :
Class1.h
<font style="color:blue;">#if</font> !<font style="color:blue;">defined</font>(__CLASS1_H_INCLUDED__)
<font style="color:blue;">#define</font> __CLASS1_H_INCLUDED__
<font style="color:green;">
<font style="color:blue;">#endif</font><font style="color:green;">//__CLASS1_H_INCLUDED__</font>
Class2.h
<font style="color:blue;">#if</font> !<font style="color:blue;">defined</font>(__CLASS2_H_INCLUDED__)
<font style="color:blue;">#define</font> __CLASS2_H_INCLUDED__
<font style="color:green;">
<font style="color:blue;">#endif</font><font style="color:green;">//__CLASS2_H_INCLUDED__</font>
that concern only .h files. don't forget !
TOXCCT >>> GEII power
|
|
|
|
|
sir,
I need a code to get a selected text from any window to the clipboard and I would like to know how windows implements cltr+c for copying a selected text from any window.
|
|
|
|
|
//copy
CString str="alok"
if (::OpenClipboard(AfxGetApp()->m_pMainWnd->GetSafeHwnd())) {
if(::EmptyClipboard()) {
if (::SetClipboardData(CF_TEXT,str) == NULL ) {
AfxMessageBox( "Unable to set Clipboard data" );
} } }
CloseClipboard();
//paste
CString str;
if (OpenClipboard()) str=GetClipboardData(CF_TEXT);
CloseClipboard();
that willl help you lot
Alok Gupta
visit me at http://alok.stormpages.com
|
|
|
|
|
Have a txt file that looks like this
2345
5332
4433
4343
5555
6666
....
Want to read and write it to another text file like this (3 columns)
2345 5332 4433
4343 5555 6666
using c++ (non MFC)
any help will be greatly appreciated
|
|
|
|
|
openinfile();
openoutfile();
int i = 0;
while(!endoffile)
{
readfrominfile;
writetooutfile;
i++;
if(i==3)
{
write '\n' to out file;
i = 0;
}
}
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|
|
Hi,
I'm interested in writing a program that must keep track of the current active window.
I would like to get messages from the OS that tells me when the user switches from app to app.
What is the best way to do this?
Should I use a WM_TIMER and just check what process the current active window belongs to?
(actually, I don't know exactly what function I should use to find the current active window and process)
Or is there a way to hook into something that would notify me on changes?
Samples, comments would be wonderful!
Thanks,
Dave
|
|
|
|
|
To use SetWindowsHookEx() to get it!
|
|
|
|
|
what are those commands whose type is similar to "AFX_IDP_COMMAND_FAILURE"?
When to use it?
|
|
|
|
|
I have a function that responds to a message by incrementing a counter variable by 1:
OnAction(WPARAM wParam, LPARAM lParam)<br />
{<br />
m_nCounter += 1;<br />
}
The message that it responds to is posted twice using PostMessage, once immediately after the other (like so):
::PostMessage(GetSafeHwnd(),WM_ACTION,0,0);<br />
::PostMessage(GetSafeHwnd(),WM_ACTION,0,0);<br />
The strange thing is that if i modify the function to display a MessageBox with the value of the counter (like so):
OnAction(WPARAM wParam, LPARAM lParam)<br />
{<br />
CString string;<br />
m_nCounter += 1;<br />
string.Format("%d",m_nCounter);<br />
MessageBox(string);<br />
}
I get two message boxes, as I should; however the values in the message boxes are 2 then 1, not 1 then 2.
Howcome I am receiving 2 then 1, rather than 1 then 2 from the message boxes as you would expect?
Any help would be greatly appreciated.
Thanks
|
|
|
|
|
both the message box comes on together?
as far as i know, message boxes in certain events could be very tough way of debuging the app coz the message boxes starts pumping the messages, so other messages too gets executed.
try TRACE instead.
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|
|
::SendMessage(GetSafeHwnd(),WM_ACTION,0,0);
::SendMessage(GetSafeHwnd(),WM_ACTION,0,0);
<made in="" china="">
if you want to get the result as you say,you should write like these.
when we use postmessage to send the message,the application
only send the message to CWnd,then return,the application does not
wait for the Command to be carried out.
when we use sendmessage to send the message,the appliation return
when the command be carried out.If we does not wait for the command
to be carried out.The message will be save in the message queue,
so the message is FILO,not FIFO
zhengyb@nanjing-fnst.com
|
|
|
|
|
I want to write something like the Sub7 Configure program, where it overwrites some of the values already in the seperate exe.
I've tried changing some of the constant data in the program and saving it but it doesn't work. I think it's because I need to change some of the info in the EXE header.
My problem is that I downloaded a EXE Header info checker and checked a program I made, them I changed some stuff in that program and checked it again and it was all the same!
Any ideas on how I can change what's already in the exe?
P.S. I don't want to use String Table Resources either.
wWw.KruncherInc.cOm - My cool programs
|
|
|
|
|
how do you split an integer variable into 4 byte variables, I'm looking for a function to achieve this.
int i;<br />
byte b1,b2,b3,b4;<br />
<br />
b1 = Byte1(i);<br />
b2 = Byte2(i);<br />
b3 = Byte3(i);<br />
b4 = Byte4(i);
Can anyone help?
Thanks
|
|
|
|
|
Many way to do this.
One brute force way is:
b1 = i & 0x000000ff;
b2 = (i & 0x0000ff00) >> 8;
b3 = (i & 0x00ff0000) >> 16;
b3 = (i & 0xff000000) >> 24;
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!
|
|
|
|
|
not a very safe-cast method but who cares it works:
<br />
int i = 12345;<br />
unsigned char byte1 = ((unsigned char*)&i)[0];<br />
unsigned char byte2 = ((unsigned char*)&i)[1];<br />
unsigned char byte3 = ((unsigned char*)&i)[2];<br />
unsigned char byte4 = ((unsigned char*)&i)[3];<br />
r -€
|
|
|
|
|
I will add this one:
int i=12345;
BYTE* ab = (BYTE*)&i;
// use ab[0-3]
Igor Green
http://www.grigsoft.com/ - files and folders comparison tools
|
|
|
|
|
assume i is 2 bytes for simplicity.
int i = 0x1234;
byte c1,c2,
then according to your logic, the output would be like this.
c1 = 0x34; and
c2 = 0x12;
which is wrong.This is because the way it is stored in the memory. and if you consider for 32bit integer value, the error would just double.
and according to PJ
c1 = 0x12; &
c2 = 0x34;
here the output is correct,
hope you got the picture now.
|
|
|
|
|
Where should I place my exe so that it starts running when Windows starts
|
|
|
|
|
With Windows XP:
C:\Documents and Settings\You User Name\Start Menu\Programs\Startup
Signature under construction.
|
|
|
|
|
that depends on the language windows is running...
for the french version, copy you exe into C:\Documents and Settings\"your user name"\Démarrer\Programmes\Démarrage
there should have a way to get this folder directly...
TOXCCT >>> GEII power
|
|
|
|
|
SHGetSpecialFolderLocation(..)
with csidl
CSIDL_DESKTOP
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|
|
All these starts only when user logs in.
another way is to place exe path in
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
or
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
greatest thing is to do wot others think you cant suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
the simplest method is
under the registry
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
create a String type key and put full path of your exe
like c:\YourFolder\YourExe.exe
I want to change Myself..Can u help me?
|
|
|
|
|
By placing my exe in the given path, its not activated when Windows starts up
|
|
|
|
|
By placing my exe in the following path(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run), the exe does not starts running automaticaly when Windows starts up
|
|
|
|