|
You're obviously using new "PC"'s. You'll have to look deeper into ACPI AFAIK.
Best of luck. I don't envy your quest. Should you however find out something useful I hope you'll post a small CP article about it (even that it's not Win32 per se).
|
|
|
|
|
Will WinExec only execute executable files ?
Is there any other function that would call the C++ program when a button is pressed and also will allow me to pass data to the function ?
I am designing a screen in Visual C++. Any help would be appreciated.
Thank you in advance
|
|
|
|
|
All arguments have to be passed in the command line.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Hey Tim , off topic and besides the normal CSTringT discussion that we and others are having at WTL discussion group, I thank you about the tip that interlockedincrement translates to a nop instruction in ST , and I want to ask you where you learned that, you checked the assembly or you did took knowledge by other means ?
Cheers,
Joao Vaz
The Most Unhappy and Frustrated TCL programmer,besides that a Happy guy
|
|
|
|
|
Hey, that was you over there.
I looked at the machine code. Used the debugger to step into the routine.
But it isn't that it is NOPed in a ST program, it is that it is NOPed on a single processor system.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Tim Smith wrote:
But it isn't that it is NOPed in a ST program, it is that it is NOPed on a single processor system.
, I wanted to write that, but my head on this monday isn't at 100% after the weekend
Tim Smith wrote:
Hey, that was you over there
, didn't you discovered ??? The 2nd and further posts have my name and I exchanged some posts with you about this same issue on CP ! Are you joking or are you serious ?
Cheers,
Joao Vaz
The Most Unhappy and Frustrated TCL programmer,besides that a Happy guy
|
|
|
|
|
Heh, I will claim the same weekend clouded brain.
No, actually, I am very very bad with names. I could have sworn your name was spelled differently. But I thought it was you.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Tim Smith wrote:
I will claim the same weekend clouded brain
Tim Smith wrote:
I am very very bad with names
You are not alone on this
Tim Smith wrote:
But I thought it was you
Nice thought .
Cheers,
Joao Vaz
Frustrated TCL programmer,good c++ programmer wannabe
|
|
|
|
|
Along wih the name of the program itself, WinExec can pass an arbitrary number of commandline parameters --these parameters the program has be to be designed to accept. Check CCommandLineInfo for further info on commandline parms, or have a look at standard argc and argv parameters for main -based console apps.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
To pass data to an already running (Windows) program, post the target program a WM_COPYDATA message. See the online docs for more info.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
If you want a window to pop up when you click a button, you need not create a separate program for that. You can add a new dialog to your program and pop that up instead.
But if you insist on having a separate program pop up you can use ShellExecute to pop it up. Or ShellExecuteEx if you want to keep track of your spawned app.
See:- http://www.codeproject.com/useritems/newbiespawn.asp
Passing arguments to the new program is quite easy with ShellExecute/Ex
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
You must pass data in the command line. you can use 'system' insted of 'winexec'
E.g:-
system ("myapp.exe data1 data2")
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
Hi,
I'm using IVideoWindow to play a video, but I want the video to stop playing as soon as any key is pressed on the keyboard. I read somewhere that you need to use put_MessageDrain() to do this, but I can't get it to recognise my other window to take messages (the other window has been registered but not shown yet)...
Any ideas on how I can get the ActiveMovie Window to close on any key press?
Many thanks for any suggestions,
Keith
|
|
|
|
|
Anybody? This has me totally stumped. Incidentally, I have based my code on the "playit" sample that comes with the Dshow SDK for Directx 6.1.
Thanks,
Keith
|
|
|
|
|
Ambit wrote:
I want the video to stop playing as soon as any key is pressed on the keyboard
If you want it to stop for any key pressed, then I see but two possibilities:
- Implement it as an application that takes care of all keyboard input.
- Hook the global keyboard input handling.
I'm sure you'd be hated for doing the latter.
|
|
|
|
|
Can anyone, give set of instructions to setup a button on a visual screen to execute a (.exe) program. I already have built a .exe.
Couple of questions
1) how to let the button execute this program
2) also how will the button know where the .exe program is. In other words, how do u let the button know the path for this program.
Thank you
M
|
|
|
|
|
Read the FAQ. ShellExecute is what you're after.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
See http://www.codeproject.com/useritems/newbiespawn.asp
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Learning wrote:
a button on Visual C++ to execute a pgm
If you just want some entry on the "IDE" of Visual C++ to execute other executables, here's the instruction:
1) Click the menu of VC++ [Tools]->[Customize...], you would see a dialog "Customize".
2) Choose the third tab "Tools", here it manages what you see in the sub-menu of Tools, like : "Register control", "Visual Component Manager", "Error lookup", etc.
3) There's a "New" button beside the "Delete" button, click it to add a new entry. Just give a name for what you want to execute, ex. "My application 003". Remember the sequence you add.
4) Then you see "Command", that's for specify the target path and filename.
5) Then you switch back to the first tab "Command", choose category "Tools", drag the icon hammer-N out. Thus you get your button!
Maxwell Chen
|
|
|
|
|
try this
void CTestdlgDlg::OnButton1()
{
// Two commands here , Both are working.
// TSys.exe is in applicatin path
WinExec("TSys.exe",SW_SHOWNORMAL);
//In a defferent path
WinExec("F:\\GauShare\\TSys.exe",SW_SHOWNORMAL);
//C++ Command
system("F:\\GauShare\\tsys.exe");
}
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
Hi everybody,
I'm trying to change the frame layout dynamically. But I always get
ASSERT_VALID fails with illegal vtable pointer.
ASSERT_VALID fails with illegal vtable pointer.
HEAP[CADSplitterTest.exe]: Invalid allocation size - C02740D0 (exceeded 7ffdefff)
Warning: Uncaught exception in WindowProc (returning -1).
Warning: Window creation failed: GetLastError returns 0x00000578
Warning: couldn't create client pane for splitter.
by the second call trying a CreateView.
Here's my actual code:
BOOL Im_FrameWnd::SetViewLayout(ViewArrangement NewLayout, CCreateContext* ActContext)
{
if ((NewLayout != m_ViewLayout) || (m_Initialize))
{
if (ActContext == NULL)
{
ActContext = &m_Context;
}
if (!m_Initialize)
m_MainSplitter.DestroyWindow();
int HalfWidth, HalfHeight, ThirdWidth, ThirdHeight;
HalfWidth = HalfHeight = ThirdWidth = ThirdHeight = 10;
switch (NewLayout)
{
case TWOVIEWSVERT:
{
m_MainSplitter.CreateStatic(this,1,2, m_Style, AFX_IDW_PANE_FIRST);
/* CalcSizes(HalfWidth, HalfHeight, ThirdWidth, ThirdHeight);
m_MainSplitter.SetColumnInfo(0, HalfWidth, 10);
m_MainSplitter.SetColumnInfo(1, HalfWidth, 10);
*/
m_MainSplitter.CreateView(0,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(0,1, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
}
break;
case TWOVIEWSHOR:
{
m_MainSplitter.CreateStatic(this,2,1, m_Style, AFX_IDW_PANE_FIRST);
/* CalcSizes(HalfWidth, HalfHeight, ThirdWidth, ThirdHeight);
m_MainSplitter.SetRowInfo(0, HalfHeight, 10);
m_MainSplitter.SetRowInfo(1, HalfHeight, 10);
*/
m_MainSplitter.CreateView(0,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(1,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
}
break;
/* case THREEVIEWSTWOLEFT:
SplitColumn(myRect.Width()/2);
DeleteView(0,0);
BuildChildSplitter(2,TRUE);
/*
m_HelpSplitter1 = new CSplitterWnd();
m_HelpSplitter1->Create(this,1,2, CSize(10,10), NULL,WS_CHILD | WS_VISIBLE, AFX_IDW_PANE_FIRST+10);
CreateView(0,0, NULL);
break;
case THREEVIEWSTWORIGHT:
break;
case THREEVIEWSTWOTOP:
break;
case THREEVIEWSTWOBOTTOM:
break;
*/ case FOURVIEWS:
{
m_MainSplitter.CreateStatic(this,2,2, m_Style, AFX_IDW_PANE_FIRST);
/* CalcSizes(HalfWidth, HalfHeight, ThirdWidth, ThirdHeight);
m_MainSplitter.SetColumnInfo(0, HalfWidth, 10);
m_MainSplitter.SetColumnInfo(1, HalfWidth, 10);
*/
m_MainSplitter.CreateView(0,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(0,1, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
/* m_MainSplitter.SetRowInfo(0, HalfHeight, 10);
m_MainSplitter.SetRowInfo(1, HalfHeight, 10);
*/
m_MainSplitter.CreateView(1,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(1,1, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
}
break;
/* case FOURVIEWSTHREELEFT:
break;
case FOURVIEWSTHREERIGHT:
break;
case FOURVIEWSTHREETOP:
break;
case FOURVIEWSTHREEBOTTOM:
break;
*/
default:
{
DWORD TempStyle = WS_CHILD|WS_VISIBLE|WS_BORDER|SPLS_DYNAMIC_SPLIT;
m_MainSplitter.Create(this,2,2, CSize(10,10), ActContext, TempStyle, AFX_IDW_PANE_FIRST);
if (!m_Initialize)
{
m_MainSplitter.CreateView(0,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(0,1, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(1,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(1,1, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
}
}
break;
}
m_ViewLayout = NewLayout;
RecalcLayout();
}
if (m_Initialize)
m_Initialize = FALSE;
return (TRUE);
}
BOOL Im_FrameWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
m_Context.m_pNewViewClass = pContext->m_pNewViewClass;
m_Context.m_pCurrentDoc = pContext->m_pCurrentDoc;
m_Context.m_pNewDocTemplate= pContext->m_pNewDocTemplate;
m_Context.m_pLastView=NULL;
m_Context.m_pCurrentFrame=this;
m_ViewClass = pContext->m_pNewViewClass;
return SetViewLayout(m_ViewLayout, pContext);
}
Since this is my first trial with CSplitterWnd I don't find the error exactly (I'm afraid it's
my CRuntime Class - but I'm not sure.
Studying the examples brings no help because they only create the layout at generation.
Best regards,
Patrik Müller
|
|
|
|
|
OK - I've found my errors!!
Best regards,
Patrik Müller
|
|
|
|
|
Hi
I've been working the whole day on this problem, but I can't find a solution.
Say I have char as follows:
const char * buf
This char may contain MORE than one \0 character. It may therefore look like "this\0isthewhole\0char"
What I want to do now is to replace all \0 with a "+" or something else.
How can I do it? So far I have this, which doesn't work:
while(*buf++)
{
if(*buf == '\0')
*packet = '+';
else
*packet = *buf;
*packet++;
}
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I might be wrong, but I can't see how your code could work because you don't have a marker to signify the end of the string. Strings like this (that contain nulls) typically contain two nulls at the end so that any code that needs to parse it can find the end. Therefore, in your code that sets this string, you simply need to ensure that it ends with two nulls. From there, the code is farily simple to parse it terminating only when back-to-back nulls have been encountered. Otherwise, you've got no way of knowing when the string ends.
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
OK, my fault, you're right..the string contains an \0 at the end.
But how do I get my code to work?
modified 12-Sep-18 21:01pm.
|
|
|
|
|