|
I have a question:
supposing I call the
LookupAccountSid(NULL, ptiUser->User.Sid, szUser, pcchUser,szDomain, pcchDomain, &snu))
and I get the sid how can I print this sid?
|
|
|
|
|
In LookupAccountSid, the SID is an input parameter and what you get is user and domain names as character strings...
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
yes you are right but anyway I have the sid I just want to print it how do I do that ?
|
|
|
|
|
|
LPSTR * StringSid;
ConvertSidToStringSid(ptiUser->User.Sid,StringSid);
this gets me the run-time error " the variable StringSid is being used withouth having been initialized
so I try to initialize it:
LPSTR toader=new char[1024];strcpy(toader," ");
LPSTR * StringSid=&toader;
but this gets me a error also about access memory violation
what is the good way of doing this?
|
|
|
|
|
You're not calling it quite right.
ConvertSidToSidString(sid, &string);
you must pass a *pointer* to a pointer, not just the address of the string. The function then modifies this pointer and returns the string this way.
james
http://www.catch22.net
|
|
|
|
|
hi,
i have provided a context menu for copy/paste operations between two listctrl's in my application. but the problem i am facing is that how will i identify from which list ctrl the user has clicked copy and in which ctrl the user clicks paste from the context menu. i.e whether i have to copy from listctrl 1 to listctrl 2 or vice-versa. can anyone help me out
thanks
aditya
|
|
|
|
|
consider using two identical context menus using unique IDs for the menu items.
Steve
|
|
|
|
|
Hi! Sorry for my English. I have a problem. . When I try to compile my project it returns hundreds of error like that:
d:\documents and settings\phoenix\мои документы\my_app\solution1\autonap\Form2.h(16): error C2653: 'autonap' : is not a class or namespace name
Class 'autonap' is declarated in header that i include to Form2.h.
There is code example:
<br />
#pragma once<br />
<br />
using namespace System;<br />
using namespace System::ComponentModel;<br />
using namespace System::Collections;<br />
using namespace System::Windows::Forms;<br />
using namespace System::Data;<br />
using namespace System::Drawing;<br />
<br />
<br />
int autonap::day;
int autonap::mounth;
int autonap::year;
int autonap::hour;<br />
int autonap::minute;<br />
int autonap::second; <br />
<br />
<br />
#include "main.h"<br />
#include "Form1.h"<br />
#include "List.h"<br />
#include "Settings.h"<br />
Its part of code. I have such string else
autonap::writetoini()
And no error messages show to this string!
Can somebody help me?
|
|
|
|
|
Hi,
do the posted lines of code appear in your 'Form2.h' in just the same sequence ?
If so, try to put the using directives below your includes. (Your definitions as well)
Regards
If I have seen further, it is by standing on the shoulders of giants.
Isaac Newton
|
|
|
|
|
do the posted lines of code appear in your 'Form2.h' in just the same sequence ?
Yes.
If so, try to put the using directives below your includes. (Your definitions as well)
It didn't help.
|
|
|
|
|
Maybe this can help you.
Regards
We can do no great things, only small things with great love. - Mother Theresa
|
|
|
|
|
No. I don't use wrong names and compound namespaces.
|
|
|
|
|
If your project isn't too big, and if it's not restricted, you can send me a zip file to analyse.
Regards
We can do no great things, only small things with great love. - Mother Theresa
|
|
|
|
|
IHTMLDocument2 *document; // Declared earlier in my code
HRESULT hr = GetHtmlDocument()->QueryInterface(IID_IHTMLDocument2,(void**) &document);
if (!SUCCEEDED(hr))
{
return;
}
HRESULT hresult = S_OK;
VARIANT *param;
SAFEARRAY *sfArray;
BSTR bstr = SysAllocString(OLESTR("hjgjhgjghjhgjhgjhg "));
sfArray = SafeArrayCreateVector(VT_VARIANT, 0, 2); // Creates a new one-dimensional array
if (sfArray == NULL || document == NULL) {
goto cleanup;
}
hresult = SafeArrayAccessData(sfArray,(LPVOID*) & param);//获取数组元素
param[0].vt = VT_BSTR;
param[0].bstrVal = bstr;
param[1].vt = VT_R8;
param[1].dblVal = 3.4567;
hresult = SafeArrayUnaccessData(sfArray);
hresult = document->writeln(sfArray);
cleanup:
SysFreeString(bstr);
if (sfArray != NULL) {
SafeArrayDestroy(sfArray);
}
when i debug , in SafeArrayDestroy(sfArray),an error arises : HEAP[Book.exe]: Invalid Address specified to RtlSizeHeap( 00140000, 02CF0358 ),and there is a messagebox: user breakpoint called from code at ox7c921230.
how can i dispose of it? thanks.
|
|
|
|
|
liuyue wrote:
SysFreeString(bstr);
if (sfArray != NULL) {
SafeArrayDestroy(sfArray);
From the SafeArrayDestroy documentation:
"Remarks
Safe arrays of variant will have VariantClear called on each member [...]."
I think SafeArrayDestroy is calling VariantClear on the first element of the array, which in turn will call SysFreeString on the BSTR you already released. Try not calling SysFreeString before SafeArrayDestroy and see if the error persists.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
i call SysFreeString(bstr) for bstr , the param[0] is equal to bstr , and has nothing to bstr . i release bstr , but param[0] still exist. what's more, when i make param[1].vt = VT_BSTR; param[1].bstrVal = bstr;, the problem disappears. so i think the problem has nothing with SysFreeString(bstr).
|
|
|
|
|
Hi everyong! there are some errors when linking as:
Linking...
DSRecord.obj : error LNK2001: unresolved external symbol _DSDEVID_DefaultCapture
DSRecord.obj : error LNK2001: unresolved external symbol _IID_IDirectSoundCaptureBuffer8
DSRecord.obj : error LNK2001: unresolved external symbol _IID_IDirectSoundNotify
Debug/MyDS.exe : fatal error LNK1120: 3 unresolved externals
I know that maybe some .lib file haven't been added to the project,but i do have linked "dsound.h" and "dsound.lib"
How can I solve it?
Thank you so much!
|
|
|
|
|
its a bit hard to jump in on this when you've posted very little ..
ok, if you can guarantee that those 3 functions are in dsound.lib (ie, they are declared in the header file dsound.h), then, the linker isnt finding dsound.lib - there are a number of ways to make sure it finds it ..
1) (MSVC 6) select tools -> options -> directories, (show directories for [library files]), add an entry for the directory where dsound.lib is
or
2) select project -> settings -> link [category = input] add the path to the 'Additional Library path' box ...
if those functions are NOT in dsound.lib, then you have to figure out where they come from, and (possibly) include that library .. if you can find a working example that comes with a workspace, you can often go though the settings and figure out 'what else' you need
If its a COM component, the method will be different, sorry - you may need to do whats known as 'importing a type library' using a #import directive
hope this helps a little
'g'
|
|
|
|
|
|
Thanks for this, tigress - they wernt functions I was aware of - glad someone else out there knew where they came from
'G'
|
|
|
|
|
Thank you very much.
I do have installed DirectX SDK,and I do have linked them.
I have resolved it the reason is I lefted a .lib file
that is "Dxguid.lib"
You may use 'dsound.h',dxguid.h'winmm.h'dxerr8.h'.
Thank you all the same!
|
|
|
|
|
Hi, I am trying to code for some image acquisition application and I need to handle two hardware in my coding. One of them is a camera while the other is an image pattern generator which could be programmed. The camera can be set to be on, taking in sequence of images while the image pattern generator would change at some prefix timing
I am trying to do some threading coding to run both of the device in parallel. So I am wondering whether I could do the following and get some synchronisation
acqthread{
......
......
CameraHandle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) cameraThread, (void *)this, 0, &dwThreadId);
PatternGenHandle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) PatternGenThread, (void *)this, 0, &dwThreadId);
WaitForMultipleObjects(2, hEVents, TRUE,INFINITE);
}
DWORD CameraThread(void * pv){
.......
// run a sequence of events
}
DWORD PatternGenThread(void * pv){
.......
// Load a series of patterns
}
Would it also work if I only create one thread and put the coding of one hardware into the main function? Or does the running of the main thread has piority over the subthread?
|
|
|
|
|
Watertreader wrote:
Would it also work if I only create one thread and put the coding of one hardware into the main function?
It is probably best to have a worker thread for each piece of hardware. This would leave your main thread free to act as a control for the other threads, and to do a controlled shutdown of the application. If you use your primary thread to control one piece of hardware, it is more difficult to regain control of the application if that hardware causes the thread to lock up.
Watertreader wrote:
Or does the running of the main thread has piority over the subthread?
This is not usually the case. You can alter thread priorities if you need to, however.
Software Zen: delete this;
|
|
|
|
|
before i call GetQueuedCompletionStatus function, GlobalAlloc have no problem. but after i call GetQueuedCompletionStatus function, many functions meet a "int 3" . why????????? in C++
sd
|
|
|
|