|
i am having two exes i called them using shell execute. the issue is i have to call the second one only after finishing the firs texe. how to achieve this. i cant get in shell execute
|
|
|
|
|
Use WaitForSingleObject() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
no it doesnt work. both exes are executing at a time
|
|
|
|
|
Then you've done something wrong. Hows are you calling ShellExecuteEx() and WaitForSingleObject() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I have handled printing in a CFormView derived class in order to print my project's settings. It works on Win2K and WinXP platforms.
The problem occurs on just some of WinXP platforms with a HP LaserJet 1200 series printer installed. Also other printers like Samsung SCX-4X16 series work fine on these systems.
This issue is not seen on other systems with Win2K or WinXP platforms using same printers.
Here is the problem:
First I used CDC::GetTextExtent function, but it crashed in following line in debug mode and didn't work properly in release mode (returned invalid size)
VERIFY(::GetTextExtentPoint32(m_hAttribDC, lpszString, nCount, &size));
Then I used GetTextExtentPoint32 API function in my code to see the reason and it returned 0 (GetLastErrorCode() returned 87 "The parameter is incorrect").
All the parameters that I passed to function were correct,
The only parameter that might have contained invalid value was CDC::m_hAttribDC. (which is handled by MFC itself, and I didn't Set or reset it using CDC functions)
A similar problem occurs when using CDC::DrawText function, it just returns 0 too and prints out nothing, (but it works in preview mode).
Could anyone please tell me what causes these functions to fail on some particular systems when using that particular printer while the same code works fine on other systems using same printer?
|
|
|
|
|
I'm not sure why it's happening, but the symptoms seem to indicate an invalid HDC.
How is the dc being created?
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Yes you are right, the problem is in m_hDC and m_hAttribDC device context handles, but as mentioned, I didn't create, set or reset them, they are just the HDCs belonging to CDC* parameter passed to printing handlers in CFormView like OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo) and so forth.
What I want to understand is that what makes these HDCs become invalid.
Bad printer driver for those WinXPs or any other reason?
|
|
|
|
|
You've called DoPreparePrinting() at some point before hand?
If so, maybe you can trace into there in the bebugger to see what's wrong with the DC creation
(printinfo settings, bad driver, etc.).
Hopefully you have a machine that fails to test/debug on
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
you know how some benchmark programs generate trace files, well i'm wondering how do i do something like that, i just want to write a simple program and generae memory traces, perhaps ther's lots of info on the web the only problem is that i havent been able to find even one sample code; can anybody help?
|
|
|
|
|
|
redbones wrote: you know how some benchmark programs generate trace files
redbones wrote: i havent been able to find even one sample code;
Ummm you open a file, you write to it.... am I missing something?
led mike
|
|
|
|
|
led mike wrote: Ummm you open a file, you write to it.... am I missing something?
that's the problem, what do i write to the file? is it like i create a pointer to an address or what, what i'm saying is how do i get the vakue that i output to the file
|
|
|
|
|
I have a service in which i am enumarating windowstations and then all the Desktops. Then i open each desktop and get user object info to get the SID... everything is working fine on Win2000, XP but on Vista GetUserObjectInformation API returns 0 for lpnLengthNeeded which is needed to a allocated the memory
Code snippet....
HDESK hDesk = OpenDesktop(lpszDesktop, DF_ALLOWOTHERACCOUNTHOOK,TRUE, DESKTOP_ENUMERATE);
if(hDesk)
{
if(!GetUserObjectInformation(hDesk, UOI_USER_SID, NULL, 0, &dwLength))
{
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
AtlThrowLastWin32();
}
//
//If no user is associated, the value of dwLength is zero.
//
if(dwLength)
{
PSID pSid = 0;
pSid = (PSID) HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY, dwLength);
if (pSid == NULL)
AtlThrow(E_OUTOFMEMORY);
if (!GetUserObjectInformation(hDesk, UOI_USER_SID, pSid , dwLength, &dwLength))
AtlThrowLastWin32();
char str[250];
DWORD dw = 260;
GetTextualSid(pSid,str,&dw); ///code is available in MSDN
char lpName[250];
char lpDomain[250];
SID_NAME_USE SidType;
if( !LookupAccountSid(0, pSid, lpName, &dw, lpDomain, &dw , &SidType ) )
{
dw = GetLastError();
if( dw == ERROR_NONE_MAPPED ) wsprintf(ss,"=====SID == %s ====== NAME: NONE_MAPPED",str); else
wsprintf(ss,"=====SID == %s ====== NAME: %s [%d]",str,lpName,SidType);
}
}
}
|
|
|
|
|
Is DESKTOP_ENUMERATE the correct access flag you want to use?
What if you use read access specifiers, maybe something like READ_CONTROL | DESKTOP_READOBJECTS.
*edit* or maybe even GENERIC_READ (DESKTOP_ENUMERATE|DESKTOP_READOBJECTS|STANDARD_RIGHTS_READ).
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
I tried with all the combinations but its failing with all on Vista... maybe this is because in Vista MS moved all the services in Session 0 (i still have to dig into it).
|
|
|
|
|
Or possibly a security change?
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
I am currently developing a MDI application, which is going to control a flight simulator. The flight simulator application consist of 3 main objects invertor, motincard, and socket.
Invertor Object: The invertor object configures invertors for AC motors. The object enables/disables the motors to be control by analog output of the motioncard. The communication between the invertor and the application happens over RS-485.
MotionCard: The motion card object controls the motion of the system. The card has a analog output which is wired to the invertor and it controls the speed and direction of the motor. Motion card accepts a input from position encoder and has PID loop to produce the analog output voltage. The application initialize and commands card to move the motors to specific position at the specified speed.
Socket: The socket objects is just a simple object that simpifies socket communication. The socket object simpily requires you to create object and initialize. Packet are transmitted by a non-blocking read and write functions. The read&write commands just place the packet in fifo to be transmitted.
My question is which is the best way to setup all these objects to operate together within a single Finite State Machine within a MDI application. The MDI application needs to have seprate UI/dialog/CForm for each object. for example,
Invertor Object UI: need to be configured with a comm port address,
: The object also need to post it's internal data to UI for debugging
Motion Cards : needs to be configured with PID loop coefficients, velocitys, etc
: The motion card has some status information that also needs to be display in a ui
Socket Object : Provides some statistical information about about the number packets it
has recieved and transmitted. The Ui also is needed for configuration such as
: settting IP and port addresses.
Scott Dolan
Jernie Corporation
Engineering & Manufacturing
Software, Hardware, & Enclosures
|
|
|
|
|
I'm not sure what the "best" way is but IMO the OLD MDI interface is ugly and dated, unless you
really need individual child frame windows that have built in support for cascading, arranging,
etc.
I personally would use non-dragable splitter bars (or similar) to divide a window into 3
sections, and each pane could be a window or a dialog, depending on the contents.
Maybe I drifted way off the question...
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
how to call add(int i,int j) function in a mfc dll from vb application.
I have done all the steps to include c++ MFC dll to vb project.
It is working fine with function calls with no arguments like show();
But it returning garbage value when i call add(5,4) which passes arguments to the function.
my code in vb is like this:
Private Declare Function AddValues Lib "dllmfc.dll" (i,j) As Integer
Private Sub btnadd_Click()
Dim ans As Integer
a = AddValues(5, 4)
MsgBox (a)
End Sub
please tell me where i am wrong.
punit singh
|
|
|
|
|
What does AddValues() look like?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
hi thanks
Addvalues(i,j) add i & j then returns i+j.
|
|
|
|
|
punit singh wrote: Addvalues(i,j) add i & j then returns i+j.
This is not what AddValues() looks like.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
hi David,
I have created this AddValues(int i, int j) in .dll file and i am exporting this
funtion to use in VB appication.
It is in dll like this;
int _stdcall Addvalues(int i, int j)
{
return i+j;
}
it is c++ mfc dll.
punit singh
|
|
|
|
|
punit singh wrote: please tell me where i am wrong
Probably by using VB
Ok, more seriously: did you check that the function has a standard calling convention ? (There should be a __stdcall just before the function name).
In C++ you would have a crash if calling conventions are not the same but I don't know how VB manages it.
|
|
|
|
|
Two problems I see...
First, you have
Dim ans as Integer but then you use
a = AddValues(5,4)
Secondly, the argument you pass to MsgBox should be a string, and you're passing an integer.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|