|
Please explain exactly what you have done, and what you want to do. With this information I could answer "Scream and shout" and it would be an answer equally correct and incorrect.
|
|
|
|
|
Ok code first;
dll:
__declspec(dllexport) void AlstgPlug( void );
in exe:
typedef void (CALLBACK* MYFUNC)(void);
HINSTANCE hDLL = AfxLoadLibrary("FOUS21.dll");
if (hDLL)
{
FARPROC pnProc = GetProcAddress (hDLL, "AlstgPlug");
MYFUNC pnMyfunc = (MYFUNC)pnProc;
(pnMyfunc)();
FreeLibrary(hDLL);
}
It fails at the function call pnMyfunc(); It exits completely. If you need more info just ask. I am new to this so please don't assune I remembered some critical, or small step. Thanks in advance
Not one person lives in the present. Only the past. I can prove it.
|
|
|
|
|
Darroll wrote:
(pnMyfunc)();
try:
(*pnMyfunc)();
Just trying to keep the forces of entropy at bay
|
|
|
|
|
RedZenBird wrote:
try:
(*pnMyfunc)();
It does not matter. You might write: pnMyFunc(). That's not the point. Remove CALLBACK specification since your function declared as __cdecl, whereas CALLBACK use __stdcall specification
|
|
|
|
|
just do by reference
A Programmer Never Dies...
|
|
|
|
|
I have a header-style list control with two columns. I'm wanting to put an image in the 2nd column (have already successfully put an image with text in the first column). Here's how I'm doing it:
PlayerListCtrl.SetItem(nItem,1,LVIF_IMAGE,0,2,0,0,i);
What am I doing wrong?
Thanks!
|
|
|
|
|
There is no standard way to assign image to any other column except first.
You must draw it manually. Use for this purpose a NM_CUSTOMDRAW notify event. CDDS_SUBITEM indicate a current drawing subitem column. For additional info see MSDN
|
|
|
|
|
|
Thanks, that's EXACTLY what I needed!
|
|
|
|
|
The Free Ram will droped down,I want to frees up ram by myself,but I don't
know how to do it.Please give me some advice,a part of source code is perfect.
|
|
|
|
|
ummmmm are you saying u have a memory leak in your code somewhere? if so u just gots to go look hard and find it
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" biz stuff about me
|
|
|
|
|
thank you
yes,i meet the problem,but now i want to make little program just like FreeRam, can u give me some advice
|
|
|
|
|
Hi Guys,
I asked this before and didn't get any favourable answers, and I'm still struggling with this:
Issue:
When I read a BINARY file, and writing to back, I get an ASSERT
ASSERT(lpBuf != NULL);
because my binary files contain spaces and null. And when I write it back, the program treats the buffer as NULL so it throws the ASSERT.
********However, it works for text files.*******
Is there anything I'm missing? After couple of loops of the binary read operation, buf is.... buf=""; but the bytes read still the right amount. Any help will be really appreciated.
Do these kind of things happen to everyone or just me?
CClient::Read(BYTE *buf, int iSize){
CFile pFile (sFilename, CFile::modeRead|typeBinary);
while(true){
iReadSize = pFile.Read(pBuf, 4045);
if(iReadSize == 0)
break;
}
}
//this is in an async. callback fn..the event will call it up
CServer::Write(BYTE *buf, int iSize)
{
CFile pFile (sFilename, CFile::modeWrite|typeBinary);
pFile.Write(buf, iSize);
}
My ass is on fire and my brain's on smoke.
JJ
|
|
|
|
|
Merc wrote:
ASSERT(lpBuf != NULL);
This seems to indicate that you are passing a NULL pointer not that the data is NULL.....So are you sure your pointer is good?
Merc wrote:
buf is.... buf="";
Do you mean: buf (the pointer) is NULL --or-- *buf is 0 ???
Merc wrote:
Do these kind of things happen to everyone or just me?
Don't worry...It happens to all of us...
Merc wrote:
CClient::Read(BYTE *buf, int iSize){
CFile pFile (sFilename, CFile::modeRead|typeBinary);
while(true){
iReadSize = pFile.Read(pBuf, 4045);
if(iReadSize == 0)
break;
}
}
I'm just wondering: shouldn't this be more like:
CClient::Read( BYTE *buf, int iSize )<br />
{<br />
CFile pFile( sFilename, CFile::modeRead|typeBinary );<br />
while( iTotalRead < iSize )<br />
{<br />
iJustRead = pFile.Read(pBuf + iTotalRead, iSize - iTotalRead );<br />
if( iJustRead == 0 )<br />
{<br />
break;<br />
}<br />
else<br />
{<br />
iTotalRead += iJustRead;<br />
}<br />
} <br />
}
Just trying to keep the forces of entropy at bay
|
|
|
|
|
Hi,
The code you gave logically right. But, you don't have to add pBuf+iTotalRead. File pointer will automatically move itself to the next position. Adding so yields the buffer stays at one piont, considering that the buffer is a limited size. Say 4096.
Merc wrote:
ASSERT(lpBuf != NULL);
>This seems to indicate that you are passing a NULL pointer not >that the data is NULL.....So are you sure your pointer is >good?
Yes it's good since it reads all text/wri files. Since binary files do have NULL chars inside them, it's throwing that assert.
Merc wrote:
buf is.... buf="";
>Do you mean: buf (the pointer) is NULL --or-- *buf is 0 ???
Hm, I mean under debug watch window, my buf shows as pBuf=""
meaning nothing inside the buf. Do I've to reinitialize the buffer once in a while????
Thanks for writing me and sharing you thoughts.
Regards,
jj
|
|
|
|
|
Merc wrote:
ASSERT(lpBuf != NULL);
If this assert is firing....then I'd wager you have a null pointer...Seems you are not passing a good address to your read function
Just trying to keep the forces of entropy at bay
|
|
|
|
|
Hi,
Are you sure? Cuz when I debug and go through the loop, it's reading fine, meaning even though the reading buf is pBuf="" in the watch window, the read size is right and it goes on thorugh the loop. And after couple of loops of pBuf="", the buffer is then filled with actual ascii contents of the file. Is that normal? I assume so because it's a binary file, so it may have spaces, nulls, and all kinds of garbage chars. The assert only fires only on the receving end where I tried to write.
Thanks for the inputs bud.
jey
|
|
|
|
|
if i hava a class
class a
{
int a;
CString str;
};
i want to write an object into a file and send that file through a network to different computer and i want to recive that object again if i have the same class there.
may i read the same object on network from a file?
any body can explain my idea into code like
how to write object into file ?
how to read object on the network (having same class there) from file ?
r00d0034@yahoo.com
|
|
|
|
|
Dude,
are you going to send a instance of a class containig some stuff... like an array object which has some name/address/tp etc in them?
You've to serialize them. To do so, use CArchive class to read the objects into archive, and send it along the network. Look for the ref. on how to use CArhive, CSocket, and CSocketFile on msdn website.
Jey
|
|
|
|
|
How do I change the mouse cursor to hourglass so that the use can NOT click anywhere after a long task? then change back to normal cursor.
Thanks in advance.
|
|
|
|
|
HCURSOR SetCursor(
HCURSOR hCursor // handle to cursor
);
Just trying to keep the forces of entropy at bay
|
|
|
|
|
If you're using MFC:
BeginWaitCursor();
...
EndWaitCursor();
Ty
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." -Albert Einstein
|
|
|
|
|
TyMatthews wrote:
If you're using MFC:
BeginWaitCursor();
...
EndWaitCursor();
Better yet, use the RAII class CWaitCursor .
|
|
|
|
|
New question of the day. How can you download a file that needs you to accept a security certificate? Also I get a fail on the username/password using the http://UserName:Password@URL.com/file.ext. This may be due to the security certificate as well. Is there a way around this?
Darroll
Not one person lives in the present. Only the past. I can prove it.
|
|
|
|
|
Try using OpenSSL and Curl.
OpenSSL and Curl are two libraries that are used together to interface with Secure HTTP.
They're available for Dos, Windows, Unix, and Linux platforms.
You can download these libraries from the following links:
http://curl.sourceforge.net/
http://www.openssl.org/
Top ten member of C++ Expert Exchange.
http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/
|
|
|
|