Click here to Skip to main content
15,921,959 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Crop large file without temp file? Pin
Michael Dunn7-Mar-04 6:29
sitebuilderMichael Dunn7-Mar-04 6:29 
GeneralRe: Crop large file without temp file? Pin
Alexander M.,7-Mar-04 10:15
Alexander M.,7-Mar-04 10:15 
GeneralRe: Crop large file without temp file? Pin
Neville Franks7-Mar-04 11:50
Neville Franks7-Mar-04 11:50 
GeneralRef Counting Pin
monrobot136-Mar-04 18:52
monrobot136-Mar-04 18:52 
GeneralRe: Ref Counting Pin
Neville Franks6-Mar-04 21:10
Neville Franks6-Mar-04 21:10 
GeneralRe: Ref Counting Pin
monrobot137-Mar-04 2:25
monrobot137-Mar-04 2:25 
GeneralPassing information among different views Pin
DaBears6-Mar-04 17:53
DaBears6-Mar-04 17:53 
GeneralRe: Passing information among different views Pin
Neville Franks6-Mar-04 21:16
Neville Franks6-Mar-04 21:16 
GeneralCompiling problem Pin
john.angel6-Mar-04 16:25
john.angel6-Mar-04 16:25 
GeneralRe: Compiling problem Pin
Prakash Nadar6-Mar-04 16:49
Prakash Nadar6-Mar-04 16:49 
GeneralRe: Compiling problem Pin
john.angel6-Mar-04 16:52
john.angel6-Mar-04 16:52 
GeneralMFC Pin
Archer2826-Mar-04 15:00
Archer2826-Mar-04 15:00 
GeneralRe: MFC Pin
Prakash Nadar6-Mar-04 15:07
Prakash Nadar6-Mar-04 15:07 
GeneralRe: MFC Pin
Archer2826-Mar-04 18:30
Archer2826-Mar-04 18:30 
GeneralRe: MFC Pin
Archer2826-Mar-04 18:32
Archer2826-Mar-04 18:32 
GeneralRe: MFC Pin
Prakash Nadar6-Mar-04 20:22
Prakash Nadar6-Mar-04 20:22 
GeneralTrouble with GetLogicalDrives() function Pin
Dev5786-Mar-04 13:28
Dev5786-Mar-04 13:28 
GeneralRe: Trouble with GetLogicalDrives() function Pin
Curi0us_George6-Mar-04 13:44
Curi0us_George6-Mar-04 13:44 
GeneralP.S. Pin
Curi0us_George6-Mar-04 13:49
Curi0us_George6-Mar-04 13:49 
GeneralRe: Trouble with GetLogicalDrives() function Pin
P-Rex7-Mar-04 21:45
P-Rex7-Mar-04 21:45 
GeneralCould some please post a working example Pin
MeterMan6-Mar-04 12:40
MeterMan6-Mar-04 12:40 
GeneralRe: Could some please post a working example Pin
Curi0us_George6-Mar-04 13:10
Curi0us_George6-Mar-04 13:10 
GeneralRe: Could some please post a working example Pin
MeterMan6-Mar-04 14:04
MeterMan6-Mar-04 14:04 
GeneralRe: Could some please post a working example Pin
Curi0us_George7-Mar-04 12:02
Curi0us_George7-Mar-04 12:02 
Ok, I'm trying to understand some of what's going on. (I'm not a fan of mfc because it's so convoluted.)

lines 267 and 268:
CCash3mfcDlg *pdlg;
*pdlg = (CCash3mfcDlg*)CWnd::FromHandle("handle");

You definitely can't do that. First off, FromHandle is expecting an HWND, not a char *. It shouldn't even compile. Second, you're dereferencing the pointer (pdlg) and assigning a different pointer to the object pdlg points to. It's difficult to explain what that code says, because it's not valid. But looking through the rest of the function, I can't see anywhere you are using pdlg, so just remove those two lines completely. They've got several problems, and they aren't necessary for any other code.



Here's your THREADSTRUCT definition:
typedef struct THREADSTRUCT
{
CCash3mfcDlg* _this;
}THREADSTRUCT;

(You could simplify that by dropping the "typedef" and replacing the trailing "THREADSTRUCT;" with just ";". Your definition is redundant. But I don't think you should have any trouble with it.)

However, int line 254, you're setting the _this variable to an HWND value:
_param->_this = GetSafeHwnd();

That's also not allowed. An HWND and an object pointer are completely separate, relatively unrelated entities.



I'd suggest that you simplify the whole thing. Recreate your project from scratch, and only add in the bare minimum of functionality, and find the first point at which it fails. Right now, you've got a pretty big chunk of code, and that makes it harder to step through and figure out the point (or points) where you've got problems.

I'd also suggest that you change StartThread and
Ongobutton as follows:
UINT CCash3mfcDlg::StartThread(LPVOID param)
{
HWND wnd = (HWND)param;
CCash3mfcDlg * dlg = (CCash3mfcDlg*)CWnd::FromHandle(wnd);
dlg->run();
return 1;
}

void CCash3mfcDlg::Ongobutton()
{
AfxBeginThread (StartThread,GetSafeHwnd());
UpdateData(TRUE); // I actually don't know what this does, but no matter.
}

I believe that should do what you want.
GeneralRe: Could some please post a working example Pin
MeterMan7-Mar-04 16:12
MeterMan7-Mar-04 16:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.