|
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.
|
|
|
|
|
As I noted, with the string possibly containing a null character before the end, you need to ensure that you have two null characters at the end as the end-delimiter. From there, the code is very simply to parse the array until you hit that delimiter.
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.
|
|
|
|
|
Assuming buf is terminated by two null characters, this will do:
for( ; ; ){
char ch=*buf++;
if(ch=='\0'){
*packet++='+';
if(*buff=='\0'){
*packet++='\0';
break;
}
}
else *packet++=ch;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks, looks quite correct.
However, is it possible that this will result in an endless-loop if the string is not null-terminated?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
If the string is not (doubly) null-terminated, this will result in the program trying to read beyond the string contents (which can cause a GPF or a meaningless output.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi Gregor
When you have strings that contain nulls or strings that are not not null terminated, you can use the buffer manipulation functions instead of the string manipulation functions. Look them up on MSDN.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
char foo[] = "bar\0baz\0whatever";
std::replace(foo, foo+sizeof(foo), '\0', '+');
|
|
|
|
|
Hi.
I implemented a listview in a program. It works great, but not perfect. I have experience problems. First, the listview insert and display new item perfectly the if it was empty before insertion. For example.
// assume listview is empty
-----
CListView &lc = GetListCtrl();
for (int i = 0; i < 10; ++i)
lc.InsertItem(0, "testing");
-----
The code above will insert ten "testing" strings into the listview control. CListView will update the window with the ten items. However, let say that I want to add more items. Here is a technique I use.
-----
CListView &lc = GetListCtrl();
lc.DeleteAllItems();
int i;
for (i = 0; i < 10; ++i)
lc.InsertItem(i, "testing");
// inserting new lines
for (int j = i; i < 20; ++j)
lc.InsertItem(j, "new items");
Okay. The code above should work. However, sometimes CListView will not display the updated data. Again, in the example above, the program will not update the window with "new items." This seems to happen when I start to add a lot of items (100 or more). Is there some kind of a limit on the CListCtrl?
What is the proper way to add, remove, and clear a CListCtrl *and* properly redraw everything correctly?
Thanks,
Kuphryn
|
|
|
|
|