|
Hi ...
I have fixed the problem by adding the __declspec (dllexport) to the CAddin1View0 class definition. I forgot to add this. Then you have to include the Addin1.lib in the project and then the application will require the Addin1.dll to be present ... this defeats the purpose of using the ATL COM Addin ... Where I can unregister the component and the host application does not care that it is missing.
I will continue to search for a method to expose the pointer to the a CRuntimeClass using the COM interface. ???
Any ideas ??
Thanks,
Chris
<br />
#ifdef ADDIN1_DLL<br />
#define Addin1DLLSpec __declspec (dllexport)<br />
#else<br />
#define Addin1DLLSpec __declspec (dllimport)<br />
#endif<br />
<br />
class Addin1DLLSpec CAddin1View0 : public CFormView<br />
|
|
|
|
|
I've been beating my head against the wall trying figure this one out. I am trying to find a CTL when all that I have is it's "identifier". If I create the CTL using makeCTL, I can specify an identifier by entering text in the "prefix that identifies this CTL" edit box.
I have tried using CertFindCTLInStore with a find type of CERT_FIND_SUBJECT_STR and CERT_FIND_KEY_IDENTIFIER. Neither attempt has worked. Can someone point me at an appropriate example? I've posted a snippet below to short circuit some of the "back and forth" Q&A.
HANDLE storeHandle = NULL;
PCCTL_CONTEXT pCTLContext = NULL;
wstring textToFind;
wstring storeName;
if (argc != 3 )
{
wcout << TEXT("argc = ")<< argc << endl;
exit(-1);
}
storeName = argv[1];
textToFind = argv[2];
DWORD buffSize = 0;
if (storeHandle = CertOpenSystemStore( NULL, storeName.c_str()))
{
wcout << TEXT("The ") << storeName.c_str() << TEXT(" store has been opened. \n");
} else {
wcout << TEXT("The store was not opened.\n");
exit(1);
}
PCCTL_CONTEXT prevCTLContext = NULL;
pCTLContext = CertFindCTLInStore( storeHandle,
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
0,
CERT_FIND_SUBJECT_STR,
textToFind.c_str(),
prevCTLContext);
if (pCTLContext != NULL)
{
} else {
wcout << TEXT("Unable to find cert with subject of '")<< textToFind.c_str() << TEXT("'") << endl;
}
if (!CertCloseStore(storeHandle, 0))
{
wcerr <<TEXT("Failed CertCloseStore\n");
exit(1);
}
Joseph Lightfoot
|
|
|
|
|
I've never done this but just looking at the documentation I would consider using CTL_FIND_ANY and then for each one using CertFindSubjectInCTL() to confirm that what I was searching for actually existed.
|
|
|
|
|
Viola!
That was PURE magic! Thanks!
What documentation did you look at? I missed that type completely. Also, I thought that CertFindSubjectInCTL was what you used to look at the entries. Does your "magic" documentation show more about this function than MSDN?
Joseph A. Lightfoot
"It's not my fault!"
|
|
|
|
|
Joseph.Lightfoot wrote: Does your "magic" documentation show more about this function than MSDN?
http://msdn2.microsoft.com/en-us/library/aa376067.aspx
That is the documentation for CertFindCtlInStore() which contains a table entry for the CTL_FIND_SUBJECT find type which contains a link to CertFindSubjectInCTL[^]
Perhaps I'm just lucky
|
|
|
|
|
How can I convert an array of BYTE to an array of Point?
-- modified at 11:02 Friday 7th September, 2007
|
|
|
|
|
Md. Ali Naser Khan wrote: How can I convert an array of BYTE to an array of Point?
Did you intentionally leave out any information about what is in the Bytes?
|
|
|
|
|
led mike wrote: Did you intentionally leave out any information about what is in the Bytes?
Don't they contain nibbles? What else is a person supposed to bite?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
So he can't show the array contents to us, lest we would have Nipplegate[^] here!
In a code forum! Shocking!
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
// Create a region from a path.
Region pathRegion(&path); // Here path is a type of GraphicsPath class.
// Get the region data.
UINT bufferSize = 0;
UINT sizeFilled = 0;
BYTE* pData = NULL;
bufferSize = pathRegion.GetDataSize();
pData = new BYTE[bufferSize];
pathRegion.GetData(pData, bufferSize, &sizeFilled);
////////////////////////////////////////////////////////////////
Now I have data in pData.
How can I covert this 'pData' to an arry of Point type data?
|
|
|
|
|
Are you sure Region::GetData() gets you an array of Point objects?
I don't see that documented...I wonder why they didn't use "Point"
instead of "BYTE"...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Well you are forcing me to guess that you are using the GDI+ API. Apparently you feel it is our job to drag relevant information out of you. It isn't.
Md. Ali Naser Khan wrote: Region pathRegion(&path); // Here path is a type of GraphicsPath class.
Perhaps GraphicsPath::GetPathPoints(....)[^] would be a solution
|
|
|
|
|
In case you did not notice you gave us absolutely no information. We could guess, but it is not worth the effort.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
... and then you remove more useful info from your post...
Only you know what's in this array of BYTEs.
A POINT is a structure containing two LONGs. The conversion from your mystery
BYTE array could be as simple as a cast or as difficult as iterating through the bytes
and creating POINT structs from them.
In your original post, you assumed a method was returning an array of points as a byte
array, but in reality, unless you know the Windows internals and you know it's not going to
change, that was a bad assumption. There's no documentation I know of that describes what's
in those bytes.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
i have program which use this type of variable. but not defined error in compiler. plz help.
|
|
|
|
|
It's in comdef.h .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thnks, i know it is in comdef.h, which is part of windows 2003 SDK kit. i have included it but still in vain, may be some library or something elese is missing. please help. infact i have a program which work in .net 2003 but when i try to convert it in to .net 2005, this error occurs while compiling.
|
|
|
|
|
I have a application based on a CFormView class btw I use VC++ 2005. I want to know when the x button of the mainFrame is click how to send the app in the status bar instead of closing it. It already work with the File->Quit menu ( I use ON_COMMAND(ID_APP_EXIT, &NameOfTheClassView) ) but I don't know what happen in the code when the X button is clicked so I don't know where to add the code to send my app in the status bar.
Thanks for helping me.
David
|
|
|
|
|
HiEverybody wrote: I want to know when the x button of the mainFrame is click how to send the app in the status bar instead of closing it.
Search CP for Shell_NotifyIcon() examples.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I already know all the stuff concerning Shell_NotifyIcon(). My question is how to intercept the X bouton in the main window and then hide the window so that only the tray icon will be visible.... ( intercept here is the KEY word ).
|
|
|
|
|
HiEverybody wrote: My question is how to intercept the X bouton in the main window...
Handle the WM_CLOSE message.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I tried with this code. It's not working. What is missing ??
ON_MESSAGE(WM_CLOSE , CloseAppToTray)
LRESULT CSolsticeAcquisitionView::CloseAppToTray(WPARAM wParam, LPARAM lParam)
{
// MessageBox("Test"); // This is not displaying
CWnd *mainWindow;
mainWindow=AfxGetMainWnd() ;
mainWindow->ShowWindow(SW_HIDE);
return 0;
}
Thanks
David
|
|
|
|
|
Use ClassWizard (Ctrl+W) to create a function for the WM_CLOSE message. The net result will be something like:
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_WM_CLOSE()
END_MESSAGE_MAP()
void CMainFrame::OnClose()
{
CFrameWnd::OnClose();
}
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I'm using Visual Studio 2005. No class wizard in there!!!
|
|
|
|
|
HiEverybody wrote: I'm using Visual Studio 2005. No class wizard in there!!!
Technically, yes, but the functionality is alive and well.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|