|
In a dialog based application I have to disable (lock) the enter-key until the dialog is closed. I think, using a keyboard-hook will be a good idea; does anybody have experiences concerning this method?
thanks in advance
|
|
|
|
|
You mean, you don't want your dialog to be closed when the user presses 'enter' ?
There is a much easier way to do that: just override the OnOk function: don't call CDialog::OnOk() !
(Create a button with id = IDOK and create a message handler)
Hope this helps
|
|
|
|
|
for my project , i have a CView contain a CTreeCtrl member. i want to cope with the tree notify message in the view.
for instance : msg: TVN_ITEMEXPANDED
CView::OnNotify(wParam , lParam , lpResult){
}
as far as i know wParam as idCtrl,
lParam as LPNMHDR strcut point.
but msdn says
TVN_ITEMEXPANDED
pnmtv = (LPNMTREEVIEW) lParam .
what really the lParam refer to??
help me.
love program
|
|
|
|
|
I'm not into MFC but pnmtv = (LPNMTREEVIEW) lParam means you're casting the lParam into a pointer to an NMTREEVIEW structure. That structure probably contains a TVITEM structure as well,. I would guess you need to examine the state of that TVITEM.
What's the difference between a C++ programmer and God? God knows he's not a C++ programmer :
anon
|
|
|
|
|
i see , as i digesting into the document. lParam is not only a pointer to NMHDR even more of that. we could change the type of it to proper struct pointer such as LPNMTREEVIEW.
thank you.
love program
|
|
|
|
|
Hi,
I have an MFC DLL plugged in to one of the exe.I have full control of the DLL.
My question is when i execute the exe can i pass command line arguments to the exe and access within the DLL.
Pls help
Thnks
|
|
|
|
|
Yes. If the EXE has a CWinApp -derived class, you can access the m_lpCmdLine member variable. If not, you can use the __argc and __argv global variables.
|
|
|
|
|
Hi,
thanks for reply but i don't have control on the EXE source.Its like a thrid party tool.I have full conrol of the dll. So in this case what to do.?Pls help
Thnks
|
|
|
|
|
You can still access the aforementioned objects from within the DLL.
|
|
|
|
|
HI everyone,
I'm working on a dialog box which I created without being really used to C++ :
my point is that I can't (or i don't know how to) use the char strings (and i'm not even sure there are characters...) i fill in the box.
Here is the kind of advice i'd like to get :
void CTestDlg::OnChangeEdit1()
The best thing would be to get a sample code using a dialog box. For instance, the box says 'enter your name' and depending on the name entered there woulde be a few code lines dealing about the name...
I hope i'm clear enough and that I'll get an answer !
Thank you very much to you all !!
|
|
|
|
|
Hari Seldon wrote:
Here is the kind of advice i'd like to get :
void CTestDlg::OnChangeEdit1()
This looks very much like an EN_CHANGE message handler.
Hari Seldon wrote:
I hope i'm clear enough
Yes and no. As I understand it, you want a dialog box with a label, an edit control and a few buttons. Yes?
+----------------------------------------------+
|Enter your name: ______________ +--------+ |
| | OK | |
| +--------+ |
| |
| +--------+ |
| | Cancel | |
| +--------+ |
| |
+----------------------------------------------+
|
|
|
|
|
You should buy a MFC programming book for beginners. The learning curve for MFC is about 6 months.
|
|
|
|
|
Hi everyone,
I'm brand nu with
|
|
|
|
|
Hi,
I have a dialog box with a button, which when clicked executes a program by using the CreateProcess command..
The problem is , though the program has been finished (execution complete), i still see it in the task manager. It disappears only after I close the dialog box itself. Is there a way out? Due to this, if I click it thrice, i see three instances of it running simultaneously. Can any one send a solution for this?
Regards,
Deepak Samuel
|
|
|
|
|
Hi
This is from the MSDN doc for CreateProcess
"The created process remains in the system until all threads within the process have terminated and all handles to the process and any of its threads have been closed through calls to CloseHandle. The handles for both the process and the main thread must be closed through calls to CloseHandle. If these handles are not needed, it is best to close them immediately after the process is created."
Which means you have to call CloseHandle on
PROCESS_INFORMATION::hProcess
PROCESS_INFORMATION::hThread
Magnus
|
|
|
|
|
Hi ,
I have a question here regarding how to use C to restart the PC.
situation:
I am using win2000 but however I would like to bootup using a win98 floppy disk to verify my systems settings. after checking I would like the PC to reboot so that it can boot from the HD into win2000. I am thinking of using autoexec.bat to help me to automate this process.
So how can I write a simple c program to reboot my pc automatically so that i can activate the program through autoexec.bat ??
Please advise! Thank you
bk
|
|
|
|
|
Use the ExitWindowsEx() function with the EWX_REBOOT flag.
Serge
|
|
|
|
|
You need to get priveldges first.Use rebootmysystem() to get priveledges.
Best of luck.;)
///////////////////////////
void rebootmysystem()
if(!ExitWindowsEx(EWX_REBOOT| EWX_FORCE ,0))
MessageBox("Couldn't reboot! Please do it manually.", "Installation Complete", MB_OK);
////////////////////////////
//to get priveledges
void rebootmysystem()
{
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
// Get a token for this process.
if (!OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
AfxMessageBox("Cannot Proceed!. Please restart manually");
// Get the LUID for the shutdown privilege.
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
&tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1; // one privilege to set
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
// Get the shutdown privilege for this process.
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
(PTOKEN_PRIVILEGES)NULL, 0);
// Cannot test the return value of AdjustTokenPrivileges.
if (GetLastError() != ERROR_SUCCESS)
AfxMessageBox("Cannot Proceed!. Please restart manually");
// Shut down the system and force all applications to close.
}
|
|
|
|
|
Where is in palette of 256 colored bitmap -tranparent color ?
Like in 16 colored ?
thanks you.
|
|
|
|
|
No such colour. Bitmaps don't have intrinsic transparency, and don't contain mask information to allow it to be implemented simply. Most mechanisms to support this rely on a pixel at a fixed position being the reference 'transparent' colour.
There are articles on CP and MSDN about how to render bitmaps using transparency.
Steve S
|
|
|
|
|
Yes I can find pixel to set it with a color
that can be treated as transparent ?
I set That color..
that is code,
how to universaly translate it to
not show some color -getting background some way?
<br />
if (m_MemDC)<br />
{<br />
dc.BitBlt(0,0,m_Width, m_Height, m_MemDC, ((m_ImageIndex) * m_Width),0,SRCCOPY);<br />
}<br />
|
|
|
|
|
Look at the entry for TransparentBlt() in MSDN.
It can do what you want, but is only available at W2k and newer.
You can simulate its effect using a mask and a few more bitblts. Find articles about how here at CP and also at codeguru.
*duck* *dashing away zigzaging to escape the rotting fruits aimed at him*
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Useful Reference.
I will read and test as fast as only possible.
|
|
|
|
|
Also have a look at DirectX Color Key and the various Blit funtions that support it (Source and Destination Transparency).
|
|
|
|
|
:-DDear all,
I am developing an application using MFC VC++ Version 6.0 on Windows 2000 platform. The purpose of this application is to delete all the created files/folders (created/copied-pasted files).
I am using DeleteFile API to delete the files. The program is working perfectly fine but it is creating problem in case of system files
If I give a path of a system file in DeleteFile API , the function fails.
(THE SYSTEM FILE IS NOT IN USE)
//////////////////////////////
eg.
If we have two files in a folder named c:\folder, rohit.txt and MSDOS.SYS , then the following program deletes the rohit.txt file but doesnot deletes MSDOS.sys
#include <windows.h>
#include <iostream.h>
void main()
{
int x = DeleteFile("C:\\folder\\rohit.txt");
cout<<"\nValue of x is"<
|
|
|
|