-
September 21st, 2006, 06:32 AM
#1
Dialogs and graphics
Hello,
I am automating an application "Unigraphics NX 3.0" using c/c++ through VS.NET i am trying to bring up a progress bar dialog, i can get the dialog to come up but after the dialog comes up and i try to change the display to the next part in the list i get a memory access violation
if i remark the line AFX_MANAGE_STATE(AfxGetStaticModuleState());
then it switches display parts fine, but the dialog wont popup...
here's a code snippit,
can anyone tell me what im doing wrong?
Code:
tag_t
part,
starting_part;
HINSTANCE
hInstance;
HWND
pbar,
ugwin,
hWnd;
int
pct,
number_open_parts,
u_func_usage;
char
part_fspec[MAX_FSPEC_SIZE+1],
temp_file[MAX_FSPEC_SIZE+1],
log_file[MAX_FSPEC_SIZE+1],
u_func_name[MAX_LINE_SIZE+1];
UF_UNDO_mark_id_t
mark_id;
FILE
*mess_file;
AFX_MANAGE_STATE(AfxGetStaticModuleState());
hInstance = AfxGetInstanceHandle();
ugwin = GetActiveWindow();
hWnd = CreateDialog(hInstance, MAKEINTRESOURCE(COS_DIALOG_MAIN), ugwin, &WndProc);
pbar = GetDlgItem(hWnd, COS_PROGRESS);
starting_part = UF_PART_ask_display_part();
mess_file = fopen(temp_file, "w");
number_open_parts = UF_PART_ask_num_parts();
UF_CALL(UF_DISP_set_display(UF_DISP_SUPPRESS_DISPLAY));
SendMessage(pbar, PBM_SETPOS, 0, 0);
for (int i = 0; i < number_open_parts; i++)
{
pct = ((i + 1) * 100) / number_open_parts;
SendMessage(pbar, PBM_SETPOS, pct, 0);
part = UF_PART_ask_nth_part(i);
UF_CALL(UF_PART_ask_part_name(part, part_fspec));
UF_CALL(UF_PART_set_display_part(part));
}
UF_CALL(UF_PART_set_display_part(starting_part));
UF_CALL(UF_DISP_set_display(UF_DISP_UNSUPPRESS_DISPLAY));
UF_CALL(UF_DISP_regenerate_display());
DestroyWindow(hWnd);
fclose(mess_file);
Last edited by cilu; September 21st, 2006 at 06:36 AM.
Reason: code tags
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|