|
Get the Gist, Could you give a Minuscule Example of what and where,
Regards
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: Could you give a Minuscule Example of what and where,
Sure!
Follow these steps...
- Add two buttons to a fresh dialog in a sequencial order, IDC_BUTTON1 and IDC_BUTTON2
- Goto OnInitDialog(you are not restricted to OnInitDialog, you can also do this on a button click) and paste this line of code
GetDlgItem( IDC_BUTTON1 )->SetWindowPos( GetDlgItem( IDC_BUTTON2 ),
0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE ); - So now run the dialog and you will see that
the focus is on the second button i.e. IDC_BUTTON2 , I am invoking SetWindowPos on IDC_BUTTON1 and hwndInsertAfter is IDC_BUTTON2 hence IDC_BUTTON1 is moved down in the ZOrder after IDC_BUTTON2 .
So this is how we dynamically change the Z-Order or tab order.
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http:\\nibuthomas.wordpress.com
|
|
|
|
|
Got it in One,
Thanx a Lot
Bram van Kampen
|
|
|
|
|
|
Got it in One,
Thanx a lot
Bram van Kampen
|
|
|
|
|
|
Thanks to Everybody who replied. The Answer was Obvious, I made the Common mistake of not seeing the Forrest from the Trees, and trying to solve the problem at ha!
Regards to All:
Bram
Bram van Kampen
|
|
|
|
|
I have done some mistakes regarding of using TRUE / FALSE for
SetCheck / GetCheck method of CButton (they have to use BST_CHECK/BST_UNCHECK,I've got it mixed up with GetCheck/SetCheck of CListCtrl).
But It run ok since both TRUE/BST_CHECK are definced as 1
and FALSE/BST_CHECK are defined as 0
Is this considered a serious bug ? Should I make a patch ?
Sometime I wish they could use an enum for these parameters
in stead of just defined value.
|
|
|
|
|
|
Actually there was no error.
I use the wrong parameter for SetCheck function.
I wrote :
m_comboButton.SetCheck(TRUE);
m_comboButton.SetCheck(FALSE);
while I should write
m_comboButton.SetCheck(BST_CHECK);
m_comboButton.SetCheck(BST_UNCHECK);
The program has already been shipped and I fear that it might cause
a problem In the future (I test it on xp/vista and it work fine)
|
|
|
|
|
You mean, BST_CHECKED and BST_UNCHECKED.
Although, for the sake of good programming style and code readability, it's good to use those constants when calling CButton::SetCheck (may be also the third value BST_INDETERMINATE for three-state button), that is not a reason to worry in your particular case.
BST_CHECKED and BST_UNCHECKED constants have the same values like TRUE and FALSE respectively:
#define BST_UNCHECKED 0x0000<br />
#define BST_CHECKED 0x0001
#define FALSE 0<br />
#define TRUE 1
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
ovidiucucu wrote: BST_CHECKED and BST_UNCHECKED constants have the same values like TRUE and FALSE respectively:
#define BST_UNCHECKED 0x0000
#define BST_CHECKED 0x0001
#define FALSE 0
#define TRUE 1
I think he alread knows...
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.
|
|
|
|
|
xanagan666 wrote: Is this considered a serious bug ?
IMHO NO!
(1) Probably MS developers defined the MACROs keeping an eye on compatibility with TRUE/FALSE pair.
(2) Probably They will never change that values.
xanagan666 wrote: Should I make a patch ?
IMHO you'll include these minor fixes in a patch addressing major ones (maybe never?).
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.
|
|
|
|
|
Thank everyone for your answer/solution .
I will be more careful in the future.
|
|
|
|
|
I try to simulate a mouse left button down, mouse move and then left mouse button up. I want to send this events to another app (a game) to drag and drop and item. Here is what i did:
I created a timer firing every 1 sec to get the job done in steps.
step1
SetCursorPos(m_dFromX,m_dFromY);
step2
::SetFocus(wnd); //my games window's handle
::SendMessage(wnd,WM_LBUTTONDOWN,0,0);
step3
SetCursorPos(m_dToX,m_dToY);
step4
::SendMessage(wnd,WM_LBUTTONUP,0,0);
Here is what happens:
Mouse moves to first position, clicks there, then moves to the second position but it seems like the game is detecting the real mouse button state (which isn't down) and doesn't drag the item. I assume that the game is using GetAsyncKeyState to retrieve the mouse buttons' states.
Is there a way to force mouse buttons states to down or is there another way to simulate this events ?
|
|
|
|
|
Maybe check out mouse_event()[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
I do not know how to code to read all files of *.txt in a directory without putting
all the names of these file into a file.
If my program can read all the files of *.txt automatically (without knowing how many and exact file name of each) in a directory and pick up some data
in each file (all these files have the same format).
I need some code fragments.
Thanks a a lots.
|
|
|
|
|
you want FindFirstFile() and FindNextFile().
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Thanks Luc.
At present, I have to prepare a file of the file name to let the program to read this file first.
Then the program to read and process each of these files.
the file: file_inf contains:
070924104834.TXT
070924104328.TXT
070924104457.TXT
Could you please give me a few lines of code
Thanks
|
|
|
|
|
No no, you make the effort; and when stuck, ask specific questions. Then we'll help you.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
FindFirstFile(para1,para2) takes two parameters. My question is: what are types for those parameters ?
I tried to find these functions from books, but not find.
Please help
|
|
|
|
|
Try this:
http://www.google.com[^]
The very first hit for "FindFirstFile" brings you to the MSDN documentation for this function, even with an example.
|
|
|
|
|
Followed the example you suggested, I put the following code and compiled, but I can not get
the file list in the directory where the program is in. Particularly, I think I did not put
correctly: hFind = FindFirstFile(*.txt, &FindFileData);
Please advise me and thanks alots.
---------------------------------------
#define BUFSIZE MAX_PATH
WIN32_FIND_DATA FindFileData;
LPTSTR DirSpec;
//
HANDLE hFind = INVALID_HANDLE_VALUE;
CString fileName[1000];
int i=0;
DirSpec = (LPTSTR) malloc (BUFSIZE);
//
rr.DoModal();
UpdateData();
//
hFind = FindFirstFile(*.txt, &FindFileData);
fileName[0]=FindFileData.cFileName;
//
while (FindNextFile(hFind, &FindFileData) != 0)
{
i=+1;
fileName[i]=FindFileData.cFileName;
}
int nfile=i;
FindClose(hFind);
//
fprintf (f_ptr1, "%i\n", nfile);
//
for (int ii=0;ii
|
|
|
|
|
Please look here[^] for help.
Regards,
Paresh.
|
|
|
|