|
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"<
|
|
|
|
|
Dear All,
ACTUALLY The main problem with DeleteAPI file is that if the file has HIDDEN ATTRIBUTE, THEN DELETE FILE DOESNOT WORK.
Even if we specify a text file having hidden attributes , the deletefile api doesnot work.
So can anybody tell me how to delete a file which is having hidden attribute. ???
Rohit
|
|
|
|
|
Yes, use GetFileAttributes to check if the file is readonly. If it is, use SetFileAttributes to remove the readonly flag. Then delete it.
Magnus
|
|
|
|
|
If I recall correctly, ::DeleteFile does not work if the targets have any of the attributes in "system", "read only" and "hide", you need to make sure to remove all attributes from the target by calling ::SetFileAttributes(_T("c:\\folder\\MSDOS.sys"), FILE_ATTRIBUTE_NORMAL); period to perforimg the deletion.
|
|
|
|
|
I am trying to create an application that is capable of working with multiple documents, each having its own view. In the InitInstance() function I have done the following:
BOOL CTestApp::InitInstance()
{
... Other code
LoadStdProfileSettings(15); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(IDR_FIRSTTYPE,
RUNTIME_CLASS(CTypeOneDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CTypeOneView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
CMultiDocTemplate* pDocTemplateT;
pDocTemplateT = new CMultiDocTemplate(IDR_SECTYPE,
RUNTIME_CLASS(CTypeTwoDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CTypeTwoView));
if (!pDocTemplateT)
return FALSE;
AddDocTemplate(pDocTemplateT);
... Other code
I have all appropriate view and document classes in place for these doc templates and the project compiles without any problems. Every time I try to open a document saved with this app, the app just loads a blank document of the type that I tried to open. Does anyone have any suggestions? Any leads to the problem would be appreciated.
BNEACETP
|
|
|
|
|
Hello,
I had that kind of problem too, seemed to be connected with
the call to ProcessShellCommand(cmdInfo)
I bracketed the lin in an if-statement like this
<br />
if( !cmdInfo.m_strFileName.IsEmpty() )<br />
if( !ProcessShellCommand(cmdInfo) )<br />
{ return false;<br />
}<br />
Now the application just starts and waits for the user to open a file.
Regards
G. Steudtel
|
|
|
|
|
There's some info in MSDN which talks about checking the cmdInfo.m_nShellCommand and not processing it if it's CCommandLineInfo::FileNew. I've done the same with one of my apps, rather painlessly. That way it doesn't break DDE, which I believe it could otherwise do.
Steve S
|
|
|
|
|
I want to add some words below the Icon dynamically,should I redraw the Icon? Now I can only add words on the range of the size of Icon by redrawing the Icon,and it is not available for me to add words if they are too long.I think it should have some good methods to make the words text out below a Icon just similarly alike the desktop icon of windows.The words and the Icon could be dragged together.
who could give me a method? You'd better send me a source code,thank you very much!
a beginner in programming with vc++
|
|
|
|
|
I posted a message last night, but I only got one reply, so I'm posting it a bit differently. I will be needing to create an application in which I manipulate 2 or more streams of digital audio into one stream. I've never really worked with digital audio before, and somebody last night responded that I should use DirectX to handle this. As it would work out, I haven't used DirectX yet either, and I need a place where I can start.
The two biggest questions I have at this point are:
1) I need reference materials, if anybody knows of quality books that I will be able to learn the audio features of DirectX, including writing my own filters, I'd appreciate the guidance. (I tried to find books on my own, but all I could find was books teaching 3D Gaming )
2) What do I need to begin toying with DirectX C++ on my computer? I already have the Visual Studios .NET, if that helps at all. Do I need to download or buy anything to write DirectX applications, and if so, where should I look?
Thanks a lot for any help you can give me on this, it is definitely appreciated!
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
DougwW48 wrote:
What do I need to begin toying with DirectX C++ on my computer?
The DirectX SDK 9.0b (? I think thats the latest)
http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp[^]
DougwW48 wrote:
I need reference materials
The SDK has lots of samples in it, you'll probably need a filter with two input pins which will probably be a little stuffing round.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|