|
|
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
|
|
|
|
|
ya thanks
but
I did
Dim ans as Integer
ans=AddValues(5,4)
MsgBox ans
MsgBox converts it as string automatically. It is right.
as if i write like
ans=9
MsgBox ans
then it prints 9 so it converts automatically.
But still I am not getting right answet it is returning -5714 as answer and it should return 9.
punit singh
|
|
|
|
|
thanks
ya I have used _stdcall befor function name.
punit singh
|
|
|
|
|
krmed wrote: ...you're passing an integer.
Nothing wrong with that.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
ya I got the answer.
here is the code:
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
and problem is with this line
Private Declare Function AddValues Lib "dllmfc.dll" (i,j) As Integer
I have to write (ByVar a as Integer,ByVar a as Integer) instead of (i,j)
|
|
|
|
|
punit singh wrote:
I have to write (ByVar a as Integer,ByVar a as Integer) instead of (i,j)
That's because ByRef is the default used by VB.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello,
i want to create a bar that contain shortcuts, this bar is similar to the bar of windows (left bar), each click over element in the window generate new shortcuts on this bar, exactly like windows.
So, i must download an file and add it to my project ? or i have simply to play with the differents composant of visual c++ ? and how ?
Thank u for responding
GraviTy Woks
|
|
|
|
|
are you wanting to create a toolbar ?
|
|
|
|
|
Thank u for your rapid answer, finally i found the solution of my litte problem.
It was the windows explorer bar, u can see the example in this page
|
|
|
|
|
Hello!
I open an ACCESS table, this is a very big table, for open this table I use a OLE DB
with ADO Classes wrapping...but...memory problem!
I open a big table with this istruction:
<br />
m_pRecordset->Open(m_strQuery.GetBuffer(), _variant_t((IDispatch*)mpdb, TRUE),<br />
adOpenKeyset, adLockOptimistic, adCmdTable);<br />
m_strQuery.ReleaseBuffer();<br />
<\endcode><br />
<br />
Where m_pRecordset is a _RecordsetPtr.<br />
<br />
When I performe the open istruction the memory comes literally eaten.<br />
The program in order to execute the table begins to have use of of all the RAM memory.<br />
<br />
Ther'is a BUG in the ADO Provider or other FIXED ?<br />
Any Idea ??:(<br />
<br />
Thanks in advance <br />
<br />
<div class="ForumSig">Too many plans make the health badly!!</div>
|
|
|
|