|
Hi,
The function test is called like this:
CBroydn Broydn;
Broydn.test(x,N,&check,funcv);
I have to add that this code was working when I was utilizing thes functions inside a DLL.
Now I want to get out this code from the DLL. and I get this compile error c2664.
Thanks,
Claude
|
|
|
|
|
A hint might be the fact, that the compiler complains about converting a void parameter to a __cdecl function pointer returnig void. Looks to me, that the function prototype of 'funcv' is different. Probably of type pascal or samoething like that.
G. Steudtel
|
|
|
|
|
Show the protypes for funcv.
I think to use class methods as function pointers, you need to make the method static.
Jason Henderson My articles
"The best argument against democracy is a five-minute conversation with the average voter." - Winston Churchill
|
|
|
|
|
The interface IShellDispatch,has an updated interface named IShellDispatch2.
How to invoke IShellDispatch2 and all the members method.
Swarup
|
|
|
|
|
#define MY_SQL "INSERT INTO MyTable ([fldFileName]) VALUES ('%s')"<br />
sprintf(szStmt,MY_SQL, "Greensleeves.mp3"); <br />
SQLExecDirect(hStmt, (SQLTCHAR*)szStmt, SQL_NTS);<br />
<br />
#define MY_SQL "INSERT INTO MyTable ([fldFileName]) VALUES ('%s')"<br />
sprintf(szStmt,MY_SQL, "Souvenirs d'enfance.mp3"); <br />
SQLExecDirect(hStmt, (SQLTCHAR*)szStmt, SQL_NTS);<br />
Could you help me to fix this bug
thank a lot!!!
|
|
|
|
|
You should really have some sort of DB class that would automatically handle this kind of stuff for you, including replacing NULLs and such. An example would be the following:
int ApplicationInstance::StringReplace(char *cpSearch, LPCSTR cpFind, LPCSTR cpReplace, BOOL bDisableNULLCheck /*=FALSE*/, BOOL bReplaceEmbeddedQuotes /*=FALSE*/)
{
if (!cpReplace || (*cpReplace == 0 && !bDisableNULLCheck))
return 0;
int iRetval = 0;
BOOL bDeleteBuf = FALSE;
char *cpReplaceBuf = (char *)cpReplace;
int iReplaceLength = strlen(cpReplaceBuf);
int iFindLength = strlen(cpFind);
if (bReplaceEmbeddedQuotes && strchr(cpReplaceBuf,'\''))
{
LPCSTR cpQuote = strchr(cpReplaceBuf,'\'');
while (cpQuote)
{
iReplaceLength++;
cpQuote = strchr(cpQuote+1,'\'');
}
cpReplaceBuf = new char[iReplaceLength+1];
if (!cpReplaceBuf)
return -1;
char *cpDest = cpReplaceBuf;
cpQuote = cpReplace;
while (*cpQuote)
{
*cpDest++ = *cpQuote;
if (*cpQuote == '\'')
{
*cpDest++ = '\'';
}
cpQuote++;
}
*cpDest = 0;
bDeleteBuf = TRUE;
}
BOOL bSmaller = (iReplaceLength <= iFindLength);
char *p = strstr(cpSearch,cpFind);
while (p)
{
iRetval++;
// move rest of string so that the replace value fits right in.
if (bSmaller)
strcpy(p+iReplaceLength,p+iFindLength);
else
memmove(p+iReplaceLength,p+iFindLength,strlen(p+iFindLength)+1);
memcpy(p,cpReplaceBuf,iReplaceLength);
p = strstr(cpSearch,cpFind);
}
if (bDeleteBuf)
delete [] cpReplaceBuf;
return iRetval;
}
|
|
|
|
|
Hi,
I'd like to use system command but I don't like it to open console while the command is executing?
or if there is a c/c++ cmd for deleting all files in a directory like -
system("del /q *.*")
thanks
Yaniv
|
|
|
|
|
how about using ShellExecute method........
Swarup
|
|
|
|
|
Use SHFileOperation(). It supports wildcards.
|
|
|
|
|
|
I am having problems using the Adobe Acrobat ActiveX Control. I embed the control in a dialog box but when I try to generate a member variable to hold the control in Class Wizard an error is reported
"The ActiveX Control is not registered properly, or its type library number is incorrect. Try registering the control by removing and importing it in the Component Library"
Unregistering and registering the control doesn't help. So I'm not really sure where to go from here.
I am using Adobe Acrobat 5.0 (both the pdf.ocx and pdf.tlb files are present on my system)
|
|
|
|
|
The ActiveX is designed to make it difficult for you to use in an application. The pdf.ocx is not the real thing - the actual ActiveX control carries names like pdf42.ocx etc.
However, the class Id for the real ActiveX is
CLSID const& GetClsid()
{
static CLSID const clsid
= { 0xca8a9780, 0x280d, 0x11cf, { 0xa2, 0x4d, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0 } };
return clsid;
}
Use that in the normal CWnd derived class that the wizard will generate for you to hack it!
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Paul Selormey wrote:
Use that in the normal CWnd derived class that the wizard will generate for you to hack it!
My problem is that when I try to have Class wizard generate something it reports the error I mentioned in my first post.
|
|
|
|
|
Raggamuffin wrote:
My problem is that when I try to have Class wizard generate something it reports the error I mentioned in my first post.
I know. This is because the pdf.ocx is only an automation interface OCX for the real pdf ActiveX control.
Use the Class Wizard and select the pdf.tlb, it will generate the Automation interface and empty event interface for you, say CPdf.
You may search your system to find the real ActiveX or use the ClassWizard to generate a wrapper for any simple ActiveX control, then delete everything with the exception of the Create and GetClsid methods.
Replace the GetClsid method with the one I have provided in my earlier reply. Create the window, use GetControlUnknown method to retrieve IUnknown interface, and the IDispatch interface from the IUnknown. Pass the IDispatch interface to the CPdf instance, and use the CPdf instance to control it. It has LoadFile, which you can use to open a file etc.
If it is getting confusing, write to me privately, I will try to help. If interested, I could write an article with sample for CodeProject
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Hi.
I am trying to upload a variable and file thru POST thru HTTP. The script is not getting both. IE works fine and I tried to use same headers as of IE> but still it doesnt work.
I also tried to send one variable thru multipart/form-data. but its not working.
Here is the code for sending one variable.
CInternetSession session;<br />
CHttpConnection *http=session.GetHttpConnection("192.168.0.2");<br />
CHttpFile *pFile=http->OpenRequest(CHttpConnection::HTTP_VERB_POST,"/bluestar/post1.php",NULL,NULL,NULL,"HTTP /1.0",INTERNET_FLAG_RELOAD);<br />
<br />
CString sContent;<br />
sContent= CString(HTML_BOUNDARY)+"\r\nContent-Disposition: form-data; name=\"packet\"\r\r";<br />
sContent+="Faizan";<br />
CString sEnding="\r"+CString(HTML_BOUNDARY)+"\r";<br />
<br />
<br />
sContent+=sEnding;<br />
CString sPacket;<br />
CString str; <br />
sPacket="Accept: */*\rAccept-Language: en\r";<br />
sPacket+="Content-Type: multipart/form-data; boundary=" + CString(HTML_BOUNDARY)+"\r";<br />
sPacket+="Connection: Keep-Alive\r";<br />
str.Format("Content-Length: %d\r",sContent.GetLength());<br />
sPacket+=str; <br />
<br />
pFile->SendRequest(sPacket,(LPVOID)(LPCTSTR)sContent,sContent.GetLength());<br />
char szData[200];<br />
int iRead=0;<br />
while((iRead=pFile->Read(szData,200))>0)<br />
{<br />
szData[iRead]=NULL;<br />
TRACE("Read back is %s\n",szData);<br />
m_eRec+=szData;<br />
<br />
} <br />
UpdateData(FALSE);<br />
<br />
pFile->Close();<br />
http->Close();
Has anybody done this before using multipart/form-data.
|
|
|
|
|
Try this code:
CInternetSession session;<br />
CHttpConnection *http=session.GetHttpConnection("127.0.0.1");<br />
CHttpFile *pFile=http->OpenRequest(CHttpConnection::HTTP_VERB_POST,"/scripts/uploadf.cgi",NULL,NULL,NULL,"HTTP /1.0",INTERNET_FLAG_RELOAD);<br />
CString sContent;<br />
sContent= CString("--7d3335262f08b6")+"\r\nContent-Disposition: form-data; name=\"uploadfile\" filename=\"c:\\dccard.xml\"\r\n\r\n";<br />
sContent+=szXMLDocument;<br />
CString sEnding="\r\n"+CString("--7d3335262f08b6--")+"\r\n";<br />
sContent+=sEnding;<br />
CString sPacket;<br />
CString str_data; <br />
sPacket="Accept: */*\rAccept-Language: en\r\n";<br />
sPacket+="Content-Type: multipart/form-data; boundary=" + CString("7d3335262f08b6")+"\r\n";<br />
sPacket+="Connection: Keep-Alive\r\n";<br />
str_data.Format("Content-Length: %d\r\n\r\n",sContent.GetLength());<br />
sPacket+=str_data; <br />
pFile->SendRequest(sPacket,(LPVOID)(LPCTSTR)sContent,sContent.GetLength());<br />
pFile->Close();<br />
http->Close();
|
|
|
|
|
|
can somebody tell me how too trace that and user logon in or not?
use com, api or...
|
|
|
|
|
Here it is...
<br />
#define STATUS_SUCCESS ((NTSTATUS)0x00000000L)<br />
#define UNICODE<br />
<br />
VOID GetSessionData (PLUID session)<br />
{<br />
PSECURITY_LOGON_SESSION_DATA sessionData = NULL;<br />
NTSTATUS retval;<br />
WCHAR buffer[256];<br />
WCHAR *usBuffer;<br />
int usLength;<br />
<br />
if (!session ) {<br />
wprintf(L"Error - Invalid logon session identifier.\n");<br />
return;<br />
}<br />
retval = LsaGetLogonSessionData (session, &sessionData);<br />
if (retval != STATUS_SUCCESS) {<br />
wprintf (L"LsaGetLogonSessionData failed %lu \n",<br />
LsaNtStatusToWinError(retval));<br />
if (sessionData) {<br />
LsaFreeReturnBuffer(sessionData);<br />
}<br />
return;<br />
} <br />
if (!sessionData) {
wprintf(L"Invalid logon session data. \n");<br />
LsaFreeReturnBuffer(sessionData);<br />
return;<br />
}<br />
if (sessionData->UserName.Buffer != NULL) {<br />
usBuffer = (sessionData->UserName).Buffer;<br />
usLength = (sessionData->UserName).Length;<br />
lstrcpyn (buffer, usBuffer, usLength);<br />
lstrcat (buffer,L"");<br />
wprintf (L"user %s was authenticated ",buffer);<br />
} else {<br />
wprintf (L"\nMissing user name.\n");<br />
LsaFreeReturnBuffer(sessionData);<br />
return;<br />
}<br />
if ((SECURITY_LOGON_TYPE) sessionData->LogonType == Interactive) {<br />
wprintf(L"interactively ");<br />
}<br />
if (sessionData->AuthenticationPackage.Buffer != NULL) {<br />
usBuffer = (sessionData->AuthenticationPackage).Buffer;<br />
usLength = (sessionData->AuthenticationPackage).Length;<br />
lstrcpyn (buffer, usBuffer, usLength);<br />
lstrcat (buffer,L"");<br />
wprintf(L"using %s ",buffer);<br />
} else {<br />
wprintf (L"\nMissing authentication package.");<br />
LsaFreeReturnBuffer(sessionData);<br />
return;<br />
}<br />
if (sessionData->LogonDomain.Buffer != NULL) {<br />
usBuffer = (sessionData->LogonDomain).Buffer;<br />
usLength = (sessionData->LogonDomain).Length;<br />
lstrcpyn (buffer, usBuffer, usLength);<br />
lstrcat (buffer,L"");<br />
wprintf(L"in the %s domain.\n",buffer);<br />
} else {<br />
wprintf (L"\nMissing authenticating domain information. ");<br />
LsaFreeReturnBuffer(sessionData);<br />
return;<br />
}<br />
LsaFreeReturnBuffer(sessionData);<br />
return;<br />
}<br />
BuggyMax
|
|
|
|
|
Where to Find Good MFC FAQ?
|
|
|
|
|
Have you tried typing "MFC FAQ" at Google and seeing what turns up?
Kevin
|
|
|
|
|
everbody like google! so good!
'|'
|
|
|
|
|
Here are a few to get you started:
http://www.flounder.com/mvp_tips.htm
http://cui.unige.ch/OSG/people/Past/fuentes/Mfc/mfc.html
http://www.mooremvp.freeserve.co.uk/
http://www.naughter.com/
Googling for more will be a good exercise.
|
|
|
|
|
|
hi all
I've a bitmap as background in dialog based application.
Is it possible to make some change in a small rect part of this bitmap?
not in whole bitmap.Like making that small part transprint or anyother
......effect?
|
|
|
|
|