|
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
|
|
|
|
|
While working with "Execl XML toolbox" in C++, I attempt to implement
a logic which is equivalent to the following VB piece of code:
Public objExcelApplication As Excel.Application
Public objWorkBook As Excel.Workbook
Public objWorkSheet As Excel.Worksheet
Public objXmlMap As Excel.XmlMap'
1. list XML maps in the given Book:
.
.
Dim oMapInfo As Excel.XmlMap
For Each oMapInfo In objWorkBook.XmlMaps
msgbox oMapInfo.Name
Next
' 2. Pass back an Excel schema source
dim xSchema As String
xSchema = objXmlMap.Schemas(1).XML'
3. Export The Excel data as XML
dim xData As String
Call objXmlMap.ExportXml(xData)
All necessary standard libraries are #imported into my C++ code / project:
MSO.DLL - contributes MS Office
VBE6EXT.OLB - contributes VB extensions
EXCEL.EXE - for Excel.
However - none of them exposes any helpers, wrappers or any thing else
by which xmlMaps , xmlScemas collections and their associated contained items xmlMap,xmlSchema -
can be accessed easily like other Excel entities.
What did I miss?
Thanks
Hillel.
Hillel
|
|
|
|
|
Hi,
I am trying to get the types of drives (floppy, hard disk, CDROM, etc.) that Directory::GetLogicalDrives() returns. Directory::GetLogicalDrives() returns an array of strings. How do i get this in .NET?
TraileR ParK LifE 4Ever
|
|
|
|
|
I have a question about the value returned in the fifth parameter (lpulObjType ) of the OpenEntry() function.
For reference here is the prototype
HRESULT OpenEntry(
ULONG cbEntryID,
LPENTRYID lpEntryID,
LPCIID lpInterface,
ULONG ulFlags,
ULONG * lpulObjType,
LPUNKNOWN * lppUnk
}; According to MSDN[^] "Because the address book provider might return a different interface than the one suggested by the lpInterface parameter, the caller should check the value returned in the lpulObjType parameter to determine that the object type returned is what was expected."
Now that is all fine and good, but does anyone have any idea what the proper return values are for the lpulObjType parameter? How can I check the value if I have nothing to check it against? If I ask for an IMailUser interface how can I be sure, using the lpulObjType value, that the interface I get is an IMailUser interface?
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote:
Now that is all fine and good, but does anyone have any idea what the proper return values are for the lpulObjType parameter? How can I check the value if I have nothing to check it against? If I ask for an IMailUser interface how can I be sure, using the lpulObjType value, that the interface I get is an IMailUser interface?
I have never worked with this, but looking at the documentation for IMsgStore::OpenEntry[^], which also has a similar parameter, I'd guess that the object type would be one of the possibilities shown for the PR_OBJECT_TYPE property[^], and that in your particular case the expected type would be MAPI_MAILUSER , which is defined as ((ULONG) 0x00000006) in MAPIDefS.h
Hope that helps,
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Thank you, it helps very much
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|