|
I really hate to be mean, but perhaps you should read more carefully
"none of the headers i have for Visual C++" that would include "shlobj.h"
|
|
|
|
|
Most folks that pose such a question about missing functions are ignorant to the fact that a Platform SDK even exists, or that perhaps it contains newer prototypes. I was just making sure you had not overlooked that. Glad you're ok!
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Visual Studio 6.0, C/C++
I would like to run a command (batch) file from within
my app that, among other things, copies some files that
are passed to it on startup.
In the 4th parameter of ShellExecute() I have 2 parameters
separated by a blank space.
=== the command file: copy.cmd
@echo off
REM the echo command is a dignostic.
echo 1 >> log.txt
copy %1 c:\dir1
copy %2 c:\dir2
=== the Shell Execute() call
ShellExecute(NULL, "open", "copy.cmd","C:\\file1.txt C:\\file2.txt", NULL, SW_SHOWNORMAL);
When this runs I get a quick flash of the screen.
I'm guessing that a command window is opening and
immediately closing.
The command file does not seem to run.
I've tried various machinations like running
cmd.exe in parameter 3, but still can't get
my command file to execute.
Any help would be very much appreciated
Robert
|
|
|
|
|
Check out CreateProcess().
Kuphryn
|
|
|
|
|
Thank-you Kuphryn for your help!
|
|
|
|
|
You should specify the fifth parameter.
For example:
I put copy.cmd, a.log, b.log all in my d:\\temp.
ShellExecute(NULL, "open", "copy.cmd", "a.log b.log", "d:\\temp", SW_SHOWNORMAL);
Ray
|
|
|
|
|
Thank-you for your help, Ray.
Yup, I've been ignoring the 5th parameter!
Got it working now.
|
|
|
|
|
Hi Robert,
You need not to specify fifth parameter. I have tested the following on my system:
HINSTANCE hInst = ShellExecute(NULL,NULL,"c:\\test\\copy.cmd","c:\\aa.txt c:\\tt.log","",SW_HIDE);
and this is working fine on my system.
Hope it will help you
Ritu Kwatra
|
|
|
|
|
Thank-you for your help, Ritu.
I've been ignoring the 5th parameter.
Got it working now.
|
|
|
|
|
<href ="www.google.com"="">
|
|
|
|
|
Can anybody tell me how to define, where a toolbar is displayed in a CRebar-Object. When I ad an second toolbar to a CReBar, this toolbar is displayed anywhere in the left free area od the CReBar. But I want the single toolbars displayed side by side.
Any ideas?
Gabriel
|
|
|
|
|
Hi, whenever I try to call OnOpenDocument within a function in my CDocument derived class, I get a debug assertion that I can't understand/
Example:
void CMyDoc::Whatever()
{
//call OnOpenDocument with pathname
CMyDoc::OnOpenDocument("C:\\whatever.txt");
}
This will cause a debug assertion at:
if (!CRichEditDoc::OnOpenDocument(lpszPathName))
return FALSE;
How do I fix this? It crashes on AssignCopy(SafeStrlen(lpsz), lpsz); at STRCORE.cpp
Thanks
|
|
|
|
|
How can get font info and change it for TextOut() function on a dialog?
|
|
|
|
|
a float variable recieves the value -1.#IND000 in my programm.
Can anybody tell me what that means?
Thanks
|
|
|
|
|
|
i would add that the floats can have 3 values up to the range of values it can support : positive infinite, negative infinite, NaN (Not a Number).
you are is the 3rd case here...
see the iso for more informations on this...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I am using MFC Application wizard provided with VC++.Net to generate an application with DocView Support. I have selected Full Server i.e. Active document server and Active Document container.
I want to separate the view class and data class. I.e I want a form to take input and then after processing the data the data should show up in a separate form. I am unable to include view class files in any of the other class files. When I do so I face errors as listed below.
Basically I want to call the view class methods from other class. So for doing that I included the view class file in the other class but it gives me the following errors.
Please help and send me some tips if you can.
------ Build started: Project: TEST, Configuration: Debug Win32 ------
Compiling...
TESTDM.cpp
e:\Data\TEST\projects\TEST\TEST\TestModule.h(15) : error C2065: 'IDD_DIALOG1' : undeclared identifier
e:\Data\TEST\projects\TEST\TEST\TESTView.h(17) : error C2065: 'IDD_TEST_FORM' : undeclared identifier
e:\Data\TEST\projects\TEST\TEST\TESTView.h(21) : error C2143: syntax error : missing ';' before '*'
e:\Data\TEST\projects\TEST\TEST\TESTView.h(21) : error C2501: 'CTESTView::CTESTDoc' : missing storage-class or type specifiers
e:\Data\TEST\projects\TEST\TEST\TESTView.h(21) : error C2501: 'CTESTView::GetDocument' : missing storage-class or type specifiers
e:\Data\TEST\projects\TEST\TEST\TESTView.h(21) : warning C4183: 'GetDocument': missing return type; assumed to be a member function returning 'int'
Build log was saved at "file://e:\Data\Test\projects\Test\Test\Debug\BuildLog.htm"
TEST - 5 error(s), 1 warning(s)
|
|
|
|
|
The errors for "IDD_DIALOG1 " and "IDD_TEST_FORM " sound like you need to #include "resource.h" before you #include "TestModule.h" .
I would guess you also need to #include the header for your document class before you #include "TestView.h" , since the other errors sound they're complaining about that.
Software Zen: delete this;
|
|
|
|
|
Thank you Gary. It fixed all my compilation problems.
Running the application where we feed the data from one window and display in another window having list view control - I notice that data is correctly passed on for display in view class. However, I tried to create a list view control pointer like this:
CListCTRL* pList = (CListCTRL *) GetDlgItem (IDC_List1);
which in turn gives me runtime error in winocc.cpp that debug assertion failed at line 94:
Line 94 in winocc.cpp is
ASSERT(::IsWindow(m_hWnd));
If you know how to fix this problem or have any tips, I would surely appreciate.
Bruce
|
|
|
|
|
The member variable m_hWnd is the window handle for your list control. If the window handle isn't valid, it usually means that either the control doesn't exist (in which case GetDlgItem() would return NULL ), or the control hasn't been created yet.
As a rule, you need to be somewhat careful using a cast "CListCtrl *pList = (CListCtrl *)GetDlgItem(IDC_List1) " like you're doing. MFC support for the basic Windows controls (static, edit, and so on) are simple wrappers where the wrappers just send messages using the window handle. The MFC object itself doesn't add much. The common controls, on the other hand, are more complicated, and the MFC object may carry around more than the window handle. You are better off using something like this:
CListCtrl List;
List.SubclassDlgItem(IDC_List1,this); This permanently attaches the list control in your dialog resource with the ID IDC_List1 to a member variable List .
Software Zen: delete this;
|
|
|
|
|
Thanks Gary for the tips. Your insight into MFC is commendable.
I tried using your solution however, it does not solve my problem and gives debug assertion failed in winocc.cpp. After exploring the code, in debug mode I realize that Windows handle shows "unused=???"
The following code would summarize the function hierarchy:
void CTest::OnBnClickedButton1()
{
dm dm1;
dm1.Add(t1,c1,ts1,cv1);
}
void dm::Add(LPCTSTR tn,LPCTSTR cn,LPCTSTR ts,LPCTSTR cv)
{
CTestView ctv;
ctv.addData(t1,c1,ts1,cv1);
}
void CTestView::AddData(LPCTSTR tn,LPCTSTR cn,LPCTSTR ts,LPCTSTR cv)
{
int i=0,j=0;
int flag = 0;
j=rowcount-1;
//pointer to the listview control
CListCtrl* pList = (CListCtrl*) GetDlgItem(IDC_LIST1); // THIS ONE DOES NOT WORK
pList->InsertItem(0,ts);
}
Let me try visualizing this. Function1 in separate form1 calls button click which in turn calls function2 and function3 from within function2 is called to display the data in listview in separate form2. What I believe I don't get is the windows' handle being held with function1 call and not released to the function3 (listview control window calling function).
Any clues to fix this?
|
|
|
|
|
In your function dm::Add , you are creating a local variable ctv of type CTestView . This local copy is uninitialized. Its window hasn't been created, and therefore any child windows (including the list control you are really trying to access) haven't been created either. I'm guessing what you really want is to call the addData function for an existing CTestView .
You should have a pointer somewhere to your existing CTestView . If you are using the document/view architecture, you can get the active view from the frame window (your class derived from CFrameWnd ), or you can enumerate all of the views using your document class (see the member functions GetFirstViewPosition and GetNextView ).
Software Zen: delete this;
|
|
|
|
|
I am attempting to override the default interrupt handler for my keyboard.
Does anyone have a class that does such a thing using inline assembly?
I have assembly code that does this but i fail to be able to convert it to inline assembly, (i am new to assembly).
Smelly Cheese....
|
|
|
|
|
|
Hello all,
I developed a program with CRectTracker for a computer with touch panel. But the eight handles are very
hard to click or select with touch pen. Who can tell me how to expand the handles size?
Thanks a lot in advance.
Try to do better every day...
|
|
|
|