|
Hi all,
Got a couple of easy question for the experts.
My first question is how do i remove the "x" box to close a modal dialog?
My second question is i want to know when using CFileDialog, is there a way to have the default file name to be incremented or have a number added to the end of it if it already exists?
If someone could show me how to do this, i would really appreciate it.
Jimmy
Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
|
|
|
|
|
You can uncheck the System Menu option to remove the Maximize, Minimize, and close buttons. But if you want to have Max/Min buttons, then what you can probably do is to grey out the close button. For that you, just add this to the end of your InitDialog( )
VERIFY( pSysMenu->DeleteMenu( SC_CLOSE, MF_BYCOMMAND ) );
CFileDialog doesn't have any options like that. You will have implement it in your own way.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Hi,
A very simple problem yet I didn't find the solution. How can I make some buttons of the toolbar to remain pressed after the first click and came back up at the second click? Like the B (bold), I (italic) and U (underline) in Outlook, Word, etc.
Thanks
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
Implement the UPDATE_COMMAND_UI handler for the button, and then use pCmdUI->SetCheck ( 1 ) for keeping the button pressed, and with parameter 0 for releasing it.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
how do i detect when user kills the application using end process tab in task manager.I tried using wm_queryendsession and terminateprocess but neither seems to be work?
|
|
|
|
|
Hi,
Just try out this.
TerminateProcess is called when one try to kill process using task manager. By default, it is not possible to kill a process that is running under a security context different than the one of the process who issued the call to TerminateProcess.
So mark ur application as service or system process. Then u may get notification if sombody tries to kill ur appln through Task Manager.
The chosen One
|
|
|
|
|
Hi,
I have a slight problem with a tree control. I cannot manage to insert items again after having deleting the whole thing.
I tried this :
<br />
HTREEITEM hMyItem = m_TreeCtrl.InsertItem( "my item" );<br />
HTREEITEM hMyChildItem = m_TreeCtrl.InsertItem( "my child item", hMyItem );<br />
<br />
m_TreeCtrl.DeleteAllItems();<br />
<br />
m_TreeCtrl.DeleteItem( TVI_ROOT );<br />
<br />
hMyItem = m_TreeCtrl.InsertItem( "my item" );<br />
hMyChildItem = m_TreeCtrl.InsertItem( "my child item", hMyItem );<br />
Instead of having "my item" as the new root in my tree, I have a blank space and no child displayed. Also, the insert functions succeed as they return a value for the items. Any ideas ?
Thanks,
Vincent
|
|
|
|
|
not tested but do not believe it is system problem
(1 and 2 are the same)
don't you have any own TVN_DELETEITEM handler or WM_PAINT?
is it called in one fn like displayed?
(what when you will not insert children? when you will not delete?)
t!
|
|
|
|
|
No to everything : no special handler, no subclasssing, nothing fancy, not called in any special function, just from a button's OnClick function.
When I don't delete, my new items are appended to the previous ones, ie
<br />
|-myItem<br />
|- myChildItem<br />
<br />
becomes<br />
|-myItem<br />
| |- myChildItem<br />
|<br />
|-myItem<br />
|- myChildItem<br />
<br />
as expected if you delete nothing and append to TVI_ROOT.<br />
|
|
|
|
|
can't be problem any unpair disable/enable-draw?
t!
|
|
|
|
|
<br />
void CMyDialog::OnBnClickedButton1()<br />
{<br />
m_ctrlTree.InsertItem( "toto" );<br />
m_ctrlTree.DeleteAllItems();<br />
m_ctrlTree.InsertItem( "tata" );<br />
}<br />
Here is the code, cannot be simpler ... Maybe you could try it quickly, insert a tree, associate with a variable, insert a button, copy paste my code in the event handler and see what the tree looks like.
BTW, thanks for your time
|
|
|
|
|
sorry, can't reproduce, do you have another computer or system installed?
t!
|
|
|
|
|
Hi,
I have tested code as below and it works fine
HTREEITEM hMyItem = m_myTree.InsertItem( "my item" );
HTREEITEM hMyChildItem = m_myTree.InsertItem( "my child item", hMyItem );
// 1. I delete the items I just inserted
//--
m_myTree.DeleteAllItems();
// OR 2. (according to the MSDN that should do the same)
//--
m_myTree.DeleteItem( TVI_ROOT );
hMyItem = m_myTree.InsertItem( "my item" );
hMyChildItem = m_myTree.InsertItem( "my child item", hMyItem );
Have u checked required properties of CTreeCtrl.
I don't see any problem in your code.
The chosen One
|
|
|
|
|
Just made a test ...
works with Visual Studio 6 on another machine. Does not work on my machine with Visual Studio 2003 ! Same procedure, new MFC app with the wizards, insert a new tab control in the dialog, add a simple button, implement the event handler of the button to do: InsertItem; DeleteAllItems; InsertItem;
Glups. Does anybody have the same problem or does this just come from the piece of s**t behind my keyboard ?
|
|
|
|
|
How to stop other Process use ReadProcessMemory to Inject into my Process?don't use APIHOOK?
|
|
|
|
|
The only way is hooking the ReadProcessMemory system-widely and checking if a process wants to read from your process.
You could also patch the ReadProcessMemory function (patch on assembler level to immediately return), but I wouldn't do it. Patching can lead to serious problems. This would require that you need to overwrite the Windows kernels of the users, and I don't think that most users like it if their kernel is patched...
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
I've not tried this so it's simply a guess. ReadProcessMemory() requires that the memory being read be accessible for read access. Otherwise, the function fails. That implies that your process could somehow "lock" its heap memory.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hello all,
I am using context menu (with TrackPopupMenu()).
When I use it with an usual window, all is OK.
If I use it in a "real" fullscreen window, it appears only now and then.
I used SetForeGround(motherWindow) before,
and postmessage (WM_NULL, ...) after
and I still get a variable behavior.
here is the code:
SetForegroundWindow(myHwnd);
int result = TrackPopupMenuEx(myMenu,TPM_RETURNCMD|TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON , pt.x, pt.y, myHwnd, NULL);
PostMessage(myHwnd, WM_NULL, 0, 0);
I also use fileDialog the same way (with setforeground and postmessage), which does not appear when called . I managed to get focused on it, but it takes my window out of fullscreen mode.
fullscreen window is a DX or openGL render space.
Hope someone will be able to help me ?
Thanks in advance
|
|
|
|
|
I only know that bool is a boolean type that only
return true(1) or false(0). Then what about BOOL?
I know they are different, but I don't know how
they are different.
|
|
|
|
|
A BOOL i simply a typedef of an 4 byte int .
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
bool -> true | false
BOOL -> TRUE | FALSE
BOOL is in fact a 4 byte long integer variable. But you should only set it to TRUE or FALSE.
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Any more example? Why do we need two boolean logic data tpyes?
Does BOOL appear in C language?
|
|
|
|
|
Alex Ngai wrote:
Any more example? Why do we need two boolean logic data tpyes?
BOOL is a good choice for 32-bit applications
bool, naah, it works if you want to use it... but no...
Alex Ngai wrote:
Does BOOL appear in C language?
Just include windows.h and tada!
You can also define it yourself:
typedef int BOOL;
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
BOOL isn't standard C language no. It's defined in the Windows headers. It's used by Windows API functions to pass flags.
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|