|
One way is you create 3 that buttons in resource editor. In OnInitDialog, you set three button to be invisible.
When click on a button, you set 3 button to visible mode.
Just call: ShowWindow
Another way is to create buttons when click by CWnd::Create function
|
|
|
|
|
Idon't want a dialog, only 3 buutons.No dialog.
|
|
|
|
|
I don't understand your question. Where three buttons is? Where is the button that you clicked on? Could you give more detaily the problem?
|
|
|
|
|
How can I terminate an application when all I know is its name.
i.e. a running a batch file which starts one task (TaskA.exe) and my task.
I just want on option in my program to abort; i.e. terminate myself and TaskA.exe.
Are they any options to terminate by name, or get the process handle of TackA?
|
|
|
|
|
hi,
no there is no way other than terminate the app by using the process handle. but if we know the process name, then we can enum thru the process list to find the matching process to terminate. some two month back i have replyed the same query. i just copied that reply below:
call TerminateProcess to terminate a process. This needs the process handle as input. Call OpenProcess to get the process handle. This needs processId as input. Call Process32First and Process32Next to loop thru the running process and to get the ProcessId . Call CreateToolhelp32Snapshot before calling Process32First .
sample code is available on msdn.
rgds..mil10
|
|
|
|
|
Thanks for the information and link.
I included the following code into an ABort button, but did not manage to terminate the other application, any ideas?
HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
PROCESSENTRY32* processInfo=new PROCESSENTRY32;
processInfo->dwSize=sizeof(PROCESSENTRY32);
int index = 0;
int processID = 0;
bool handleFound = false;
HANDLE CSLProcess = NULL;
// Here we are passing snapshot handle and PROCESSENTRY32 structure to Process32Next()
// function. After execution, PROCESSENTRY32 structure will contain information about a process.
// We are iterating through a loop until we got FALSE and this means there is now no process left to visit in snapshot and our pointer is at the end of snapshot.
Process32First(hSnapShot,processInfo);
if(strcmp(processInfo->szExeFile,"Csl.exe") == 0)
{
handleFound = true;
processID = processInfo->th32ParentProcessID;
}
while((Process32Next(hSnapShot,processInfo)!=FALSE) && (handleFound == false))
{
if(strcmp(processInfo->szExeFile,"Csl.exe") == 0)
{
handleFound = true;
processID = processInfo->th32ProcessID;
break;
}
}
CSLProcess = OpenProcess(PROCESS_TERMINATE,TRUE,processID);
if(!CSLProcess)
if(TerminateProcess(CSLProcess, 0) == 0)
{
m_strGeneral = "Failed to Terminate CSL.EXE No Assecc Rights";
m_strOutput+= m_strGeneral + crlf; // Total display string; adding m_strNewText at the end
m_Output.SetWindowText(m_strOutput); // Display the new text appended onto the old text
}
else
{
m_strGeneral = "Failed to Terminate CSL.EXE";
m_strOutput+= m_strGeneral + crlf; // Total display string; adding m_strNewText at the end
m_Output.SetWindowText(m_strOutput); // Display the new text appended onto the old text
}
//Don’t forget to close handle.
CloseHandle(hSnapShot);
delete processInfo;
|
|
|
|
|
What is this test
if(!CSLProcess)
?
if OpenProcess succeed CSLProcess != NULL and in your case nothing is done
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Thanks,
Wood and tress etc.
|
|
|
|
|
Hello,
In my application I have a dialogbox which has certain settings. I want to keep those settings until the entire application stops.
Thus I need to keep the variables in memory.
NOTE: The dialog is in a separate dll (I didn't do that ). (so static or structs ,... won't work) My last option is to create a temporary file on starting end deleting it at ending the application.
tnx for your help!
|
|
|
|
|
|
structs will work; you pass a pointer to your struct as a parameter to the dialog create function. The dialog then fills in the data.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hi
before any one start slandering me about this code i did not
write it(DID NOT).
It is a Question well kinda(HW) and i realy need help i wont take any offence if i whas told i'm stupid, I just need help.
The question is(from Lecturer)
(i) Rewrite the following piece of code correcting all the
problems found(Given the followng code)
void CalculateValues(const int &a, float *b, int &c)<br />
{<br />
d = 20.4;<br />
if(*a = 0)<br />
{<br />
*a += 1;<br />
c = a + d;<br />
}<br />
else<br />
{<br />
b = c / d;<br />
c = a - b + d;<br />
}<br />
}
Included a Hint: if a=4, b=0.0, c=5 When funct return
should be: a=4, b=0.25 and c=24.15.
Need help with the prototype and calculations
PLEASE
Many Thanks.
|
|
|
|
|
bhangie wrote:
*a += 1;
false, a is not a pointer
secondly, it is declared as a const, you cannot write into it.
bhangie wrote:
b = c / d;
b is a float* , you so should write *b in your code when using it. or define it as a float& .
TOXCCT >>> GEII power
|
|
|
|
|
<br />
void CalculateValues(int &a, float &b, int &c)<br />
{<br />
<div style="margin-left=3em;">d = 20.4;<br />
if(0 == a)<br />
{<br />
<div style="margin-left=3em;">a += 1;<br />
c = a + d;</div><br />
}<br />
else<br />
{<br />
<div style="margin-left=3em;">b = c / d;<br />
c = a - b + d;</div><br />
}</div><br />
}<br />
Wout Louwers
|
|
|
|
|
|
bhangie wrote:
d = 20.4;
This variable has not been declared. I assume it is a double (or float ).
bhangie wrote:
if(*a = 0)
Variable a is being passed as a reference to CalculateValues() . Therefore, *a is an incorrect reference since a pointer was not passed to CalculateValues() .
bhangie wrote:
c = a + d;
Different types are being operated on here. You'll probably need to cast the float "down to" an int .
bhangie wrote:
c = a - b + d;
Again, different types are being operated on here. Variable b is a pointer, whereas a and d are not.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
#include<iostream>
#include<iomanip>
using namespace std;
void CalculateValues(const int &a, double *b, double &c)
//c only can be double,if float,then *b=c/d how to transfer from float to double
{c=5;
double d = 20.4;//only double.
if(a == 0)
{
//*a += 1;//error
c = a + d;
}
else
{
*b = c / d;
c =a - *b +d;
cout<<"a="<
|
|
|
|
|
How to know whether a bitmap has an alpha-channel or not?
Best regards,
Eugene Pustovoyt
|
|
|
|
|
I'm assuming you have this bitmap in memory - if it's in a file then other methods apply.
bool BitmapHasAlpha (HBITMAP hBitmap)
{
//Vars
Bitmap BITMAP;
//Get info about the bitmap
GetObject (hBitmap, &Bitmap, sizeof(Bitmap));
//Bitmaps with alpha channel use 32 bits per pixel
return Bitmap.bmBitsPixel == 32;
}
Of course, there's no guarantee that the alpha channel is actually being used!
|
|
|
|
|
Yes of cause. This method don't guaranted a result. May be better searching a value more then zero in the fourth byte of COLORREF ?
Best regards,
Eugene Pustovoyt
ICQ UIN: 161325180
|
|
|
|
|
Where does the bitmap come from?
|
|
|
|
|
Anybody have experience in developing video encoding & decoding of Canopus MVR2000 graphics card using Directshow? Due to the limitation of accompanying Amber SDk, functions like forward/play by frame cant be done. So I want to use Directshow to do this encoding & decoding task. There is a DV connected to MVR2000 card through S-Video, Directshow have no problem in dealing with digital devices like USB & IEEE1394 Video Cam, but in this case how could I initialize this analog device using Directshow? I'd appreciate any comments and samples.
|
|
|
|
|
First, do you have any experience programming DirectShow - it's not trivial!
To work with an analogue input device is really no different to using a digital device. If you enumerate the available video capture devices you analogue card should be in the list. If it isn't then you don't have a WDM driver for the card and you can't use it with DirectShow.
Having found your device you'll need to add it to a filter graph and then check whether it's analogue input pin is connected to a video cross bar filter - this allows you to select which video input (on a multiple input card) you'll be taking the signal from (S-Video in your case).
You'll then need to set the cross bar to connect your chosen input pin to the cross bar output pin that's connected to the filter representing your device.
After this a call to GraphBuilder RenderStream for the capture pin on the capture filter will build the rest of the filter graph and you'll be able to render the output.
Of course there are LOTS of other things to consider and lots of other things you could do - such as recording to a file etc. The DirectX SDK has good documentation on DirectShow but be prepared to invest some time and effort - you won't be able to put somehting together quickly.
By the way, to better understand filter graphs you can try playing with GraphEdt.exe which is part of the SDK. In fact this is probably a good place to start with your capture card - try this:
1. Run graphedt
2. Select Graph|Insert filters
3. Open the Video capture sources list
4. Double click your capture card
5. Close the Insert filter dialog
6. Right click the capture pin on the filter and select Render Pin
7. Play the graph - you should see you video in a window.
Note: You may need to play with the video cross bar filter if it's present in the graph.
Good luck, Chris
|
|
|
|
|
Hi Chris, I can't find this graphics card in GraphEdit's Video Capture Sources, but there is a MVR-D2000 Series kernel mode driver(WDM) under sound video and game controllers in Device Manager, how could this be?
|
|
|
|
|
I want to design a small utility that locks the system and asks for a password to free it again( similar to a password protected screensaver) I tried to use a SYSTEM MODAL dialog box, but it is not working ?!I'm using VC++ 6.0.
|
|
|
|