|
use LoadLibrary for load your dll and use GetProcAddress for functions in dll
and in the end use FreeLibrary
|
|
|
|
|
Colleagues,
I have a quick question.
I would think that the code pointed to by the arrow below would result in the IDR_MAINFRAME menu (and other resources) being displayed when the application starts. However, the IDR_PhotoOneTYPE menu and resources are loaded when the application starts. Is that because it just loads the first document template that is defined? If not, why is that?
Thanks in advance for any information you provide.
<br />
AfxEnableControlContainer();<br />
SetRegistryKey(_T("Local AppWizard-Generated Applications"));<br />
LoadStdProfileSettings(4);
pDocTemplate = new CMultiDocTemplate(IDR_PhotonOneTYPE,<br />
RUNTIME_CLASS(CPhotonOneDoc),<br />
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CPhotonOneView));<br />
if (!pDocTemplate)<br />
return FALSE;<br />
AddDocTemplate(pDocTemplate);<br />
pLWDocTemplate = new CMultiDocTemplate(IDR_MAINFRAME,<br />
RUNTIME_CLASS(CLyghtWayveDoc),<br />
RUNTIME_CLASS(CLyghtWayveFrm),<br />
RUNTIME_CLASS(CLyghtWayveView));<br />
if(!pLWDocTemplate)<br />
return FALSE;<br />
AddDocTemplate(pLWDocTemplate);<br />
<br />
CMainFrame* pMainFrame = new CMainFrame;<br />
if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) <----------<<<<<br />
return FALSE;<br />
m_pMainWnd = pMainFrame;<br />
m_pMainWnd->DragAcceptFiles();<br />
EnableShellOpen();<br />
RegisterShellFileTypes(TRUE);<br />
CCommandLineInfo cmdInfo;<br />
ParseCommandLine(cmdInfo);<br />
if (!ProcessShellCommand(cmdInfo))<br />
return FALSE;<br />
pMainFrame->ShowWindow(m_nCmdShow);<br />
pMainFrame->UpdateWindow();<br />
return TRUE;<br />
<br />
-- modified at 16:41 Tuesday 9th May, 2006
|
|
|
|
|
Hi,
The application maintains a list(CPtrList) of document templates. When the application starts the document template availalbe at the head of the list is loaded.
The AddDocTemplate adds the template to the tail of the above said list.
So as per ur code... this list is like below
pDocTemplate->pLWDocTemplate
Bye,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
Thanks so much...
So what does the following statement do:
// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
Again, thanks for your answer.
|
|
|
|
|
Hi,
This will be the default menu when no document is opened.
try to add the below line in the InitInstance() and see the difference.
Add the line
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
above this line in ur InitInstance()
if (!ProcessShellCommand(cmdInfo))
return FALSE;
Bye,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
Thank you so much. I really appreciate your answer.
|
|
|
|
|
Hello everyone, this is my first post here.
I have been fighting with a problem for quite some time now, and now i´m running out of time.
I have googled til i almost dropped dead
Well, to get to the point.
I have been designing a system for measuring times and speeds for use at Drag Racing competitions. im am doing it as my final year project (thesis) at my school, the Swedish Polytechnic in Finland.
Used tools:
Visual Studio 6 pro, Access 97.
VC++ / MFC, ADO.
I have designed a dialog, on this dialog i have a bunch of editboxes. The idea is that the users types a number in one of the boxes. This number is a id for a competitor. i want to fetch data about this competitor and fill the other editboxes with that data. For example the make, model and engine size of the car.
I already added the Microsoft ADO Datacontrol and hooked up a dbcombo to it. That works ok, i can scroll data with the Data control. But this is not the way i want users to enter data. The users have a paper which contains the "ladder" so they just need to enter the number of the lefthand conpetitor and then the righthand.
I tried experimenting with the find method of the Crecordset class, but that is not going very well, as visual studio wont give me the memberfunctions as i usually does.
I have coded a bit of databases in Delphi and i must say that it is much easier But i like C++ and have to stick to it because speed is very important in this case.
How do i accomplish the above?
Please somebody help me out, we are testing on saturday and i don´t want to think about what will happen if i´m not ready
Thanks in advance!
-- modified at 9:11 Wednesday 10th May, 2006
Please, pretty please respond someone
P.S Later in i need to save the contents of two double[8] arrays to another table. Is there a simle way to run pure sql?
|
|
|
|
|
How to get Activex controls Version? throught MFC
Fly Like An Eagle With MIGHTY POWER.
|
|
|
|
|
hi,
u have to set version for activex control.
just include file version and product version in Version folder in resources.
cheers
sangeet
-- modified at 1:36 Friday 12th May, 2006
|
|
|
|
|
How to get Activex controls Version? i am using on my
Fly Like An Eagle With MIGHTY POWER.
|
|
|
|
|
Hi,
Can anyone supply sample code that can get/set the state of the
"Hide extensions for known file types" check box, which is in control panel "Folder Options".
Many thanks.
|
|
|
|
|
Check out HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced in the registry.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Thanks David your advice was very helpful. Although it hasn't entirely solved my problem, which is in code similar to this.
<br />
CFileDialog D;<br />
<br />
if( D.DoModal() == IDOK )<br />
{<br />
CString strFPN = D.GetFileName();<br />
CString strExt = D.GetFileExt();<br />
<br />
CString strFPNandExt = strFPN + strExt;<br />
<br />
}<br />
My problem is that when explorer is hiding file extensions, CFileDialog::GetFileExt() returns a null string.
So what I really need to know is whether there is a way to get the file extension of a file that is selected in CFileDialog, (or maybe anywhere in the shell) when file extensions are hidden.
I don't really want to have a registry value changed and then restored
when CFileDialog::DoModal() has finished its business.
|
|
|
|
|
Atom wrote: So what I really need to know is whether there is a way to get the file extension of a file that is selected in CFileDialog, (or maybe anywhere in the shell) when file extensions are hidden.
See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Superb, just what I need.
Many thanks.
|
|
|
|
|
Hey! I have a chip card reader and some tools with it. this is the reader >>> http://www.chipdrive.de/cgi-bin/edcstore.cgi?user_action=list&category=Produkt;02_L%F6sungen;04_SC%20Tools;05_Screenshots
4th picture is where i should be programming and editing script... i think the script is in pascal language but some friend say that it could be programmed ba C++ too. Well i don't know really nothing about this....... i got this in school and have to done this by friday.
what i have to do is to programme some program which would do something like: showing my grades...
its like that... when you put chip card in reader it should pop-up new window when i would enter code... and another window would open where i would see my grades.... i would really need that!!!! please someone help me!!!!!!!!!
this is reader >>> http://www.chipdrive.de/cgi-bin/edcstore.cgi?category=Produkt;03_Chipkartenleser&user_action=detail&catalogno=P208199
this is software >>> http://www.chipdrive.de/cgi-bin/edcstore.cgi?user_action=list&category=Download%3B03_Software (the last one)
and a chip card - 256kb EEPROM
I2C protokol
brane
|
|
|
|
|
I'm really a beginner of this program,visual c++, so I'm loooking for someone that could help me.
I have to draw a pixel on the screen and I have to find its coordinates because then I'll have to move this point using(maybe) a for loop.
Thanks...and sorry for my english
Baile79
|
|
|
|
|
baile79 wrote: I have to draw a pixel on the screen and I have to find its coordinates...
This is a bit unclear. In order to render the pixel on the device, you must know it's x,y values. There shouldn't be any need to find anything.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Solved: The issue had something to do with recursing the end process function. I changed how the recursion worked and everythings fine now!
I'm writing a program to remove certain spyware. To do this it needs to get a filename and path from a clsid, possibly end a process, delete the file, and delete the clsid. The problem is, if it ends a process then the clsid variable goes from storing a clsid (eg. {00000000-0000-0000-0000-000000000001}) to having odd characters like: ↑▼% (I hope those show up. It's a cross, an upside down triangle, and a %).
This *only* happens if the code kills a process. Here's the function that searches the registry after being passed a clsid:
int delClsId(char *clsid)<br />
{<br />
HKEY keyHandle,key2,key3;<br />
char rgValue[1024];<br />
char fnlRes [1024];<br />
DWORD size1;<br />
DWORD Type;<br />
<br />
cout << "Reading key " << clsid << endl;<br />
<br />
if (RegOpenKeyEx(HKEY_CLASSES_ROOT,_T("CLSID"),0,KEY_ALL_ACCESS, &keyHandle) == ERROR_SUCCESS)<br />
{<br />
size1=1023;<br />
RegOpenKeyEx(keyHandle,clsid,0,KEY_ALL_ACCESS, &key2);<br />
cout << "Opening InProcServer32 in key " << clsid << endl;<br />
if (RegOpenKeyEx(key2,_T("InProcServer32"),0,KEY_ALL_ACCESS, &key3) == ERROR_SUCCESS)<br />
{<br />
if (RegQueryValueEx(key3,_T(""),NULL,&Type,(LPBYTE)rgValue,&size1) == ERROR_SUCCESS)<br />
{<br />
sprintf_s(fnlRes,"InProcServer32 is: %s",rgValue);<br />
cout << fnlRes << endl;<br />
delFile(rgValue);<br />
cout << "CLSID is " << clsid << endl;<br />
}<br />
RegCloseKey(key3);<br />
}<br />
<br />
if (RegDeleteKey(key2,_T("InprocServer32")) == ERROR_SUCCESS){<br />
cout << "Removed InprocServer32 Key!" << endl;<br />
} else if (RegDeleteKey(key2,_T("InprocServer32")) == ERROR_FILE_NOT_FOUND){<br />
cout << "Couldn't locate InprocServer32 key." << endl;<br />
} else {<br />
cout << "Failed to Remove InprocServer32 Key" << endl;<br />
}<br />
RegCloseKey(key2);<br />
<br />
<br />
}<br />
else strcpy_s(fnlRes,"Couldn't access system information.");<br />
<br />
RegCloseKey(keyHandle);<br />
<br />
char delKey[45];<br />
sprintf_s(delKey, "CLSID\\%s", _T(clsid));<br />
cout << delKey << endl;<br />
int i = 1;<br />
<br />
do{<br />
i = delRegKey(HKEY_CLASSES_ROOT, delKey);<br />
} while (i == 1);<br />
<br />
return 0;<br />
}<br />
From the function for killing the process I've narrowed the problem down to something that happens in the "if" part of this if/else statement:
<br />
if(TerminateProcess(hProc,0))<br />
{<br />
CloseHandle(hSnapShotm);<br />
CloseHandle(hSnapShot);<br />
CloseHandle(hProc);<br />
FreeLibrary(hInstLib);<br />
return 0;<br />
}<br />
else<br />
{<br />
CloseHandle(hSnapShotm);<br />
CloseHandle(hSnapShot);<br />
CloseHandle(hProc);<br />
FreeLibrary(hInstLib);<br />
return 602;<br />
}<br />
If the process isn't running, or there's no process to kill then there's no problem. Also, I realize usually you'll find dll files here, but I wanted to test how all these things would work together and would love to understand what's going on. I'm pretty new to c++ but have a strong programming background and large working knowledge of the registry. Thanks!
-- modified at 1:02 Wednesday 10th May, 2006
|
|
|
|
|
I was trying to retrieve the body of a message using the code below but
It is always returning
MAPI-E-NOT-FOUND:
hr = m_pfldrInbox->OpenEntry(
m_pInbox[msgID].lpProps[0].Value.bin.cb,
(ENTRYID*)m_pInbox[msgID].lpProps[0].Value.bin.lpb,
NULL,
MAPI_MODIFY | MAPI_DEFERRED_ERRORS,
&ulObjType,
(LPUNKNOWN*)&lpMessage);
//MessageBox(0, L"Message Opened", L"", 0);
if (SUCCEEDED(hr))
{
SPropValue * rgMsgprops = NULL;
ULONG rgMsgTags[] = {1, PR_BODY};
ULONG cCount = 0;
// IStream* istream;
ULONG ulNumChars;
// hr = lpMessage->GetProps((LPSPropTagArray) rgMsgTags, MAPI_UNICODE,
&cCount, &rgMsgprops);
hr = HrGetOneProp(lpMessage,PR_BODY,&rgMsgprops);
if (hr == MAPI_E_NOT_ENOUGH_MEMORY)
{
MessageBox(0, L"Not enough memory", L"", 0);
hr = lpMessage->OpenProperty(
PR_BODY,
&IID_IStream,
STGM_READ,
NULL,
(LPUNKNOWN *) &lpStream);
do
{
lpStream->Read(
sBuffer,
255,
&ulNumChars);
// if (ulNumChars >0) printf("%.*s",ulNumChars,szBuf);
}
while (ulNumChars >= 255);
// printf("\n");
hr = S_OK;
}
else if (hr == MAPI_E_NOT_FOUND)
{
//This is not an error. Many messages do not have
bodies.
//printf("Message has no body!\n");
MessageBox(0, L"Message has no body", L"", 0);
hr = S_OK;
}
else
{
//MessageBox(0, "%d", rgMsgprops[0].Value.lpszA, 0);
int x = 0;
do
{
sBuffer[x] = rgMsgprops[0].Value.lpszW[x];
x++;
//MessageBox(0, (LPCWSTR)sBuffer, L"", 0);
//bufferlen = strlen(rgMsgprops[0].Value.lpszW);
}while (((int)rgMsgprops[0].Value.lpszW[x-1] != NULL) && (x <
255));
}
}
If you can tell what is the problem please help
-- modified at 13:58 Tuesday 9th May, 2006
|
|
|
|
|
msolh wrote: It is always returning
MAPI-E-NOT-FOUND:
What is the "it" that is returning this value?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
I mean hr value is always MAPI-E-NOT-FOUND
|
|
|
|
|
I understand that. You did not indicate which of OpenEntry() , HrGetOneProp() , or OpenProperty() was returning that value.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
It is the HrGetOneProp() that is always returning the property tag that I specified. I used the same fuction to retrieve the subject and sender information using PR_SUBJECT and PR_SENDER_NAME property tags and it works. It only fails to get the message body. That is when I use PR_BODY.
-- modified at 13:59 Tuesday 9th May, 2006
|
|
|
|
|
Does this or this help?
For the message that is failing, are you sure it has a body?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|