|
Hi,
I am calling a Dialog box from a propery page. The dialog box contains an edit box which takes in numbers as user inputs. I then want these numbers to be used on the property page.
However, as I "OK" the dialog box and go back to it, the numbers have changed back to what the constructor contains.
I have used UpdataData(TRUE); but it continues to revert back to the original numbers.
void CMyPropPage::OnCallMyDlgButton() <br />
{<br />
UpdateData(TRUE);<br />
CMyDlg ViewData;<br />
ViewData.DoModal();<br />
UpdateData(FALSE);<br />
}
Have I missed something out?
kash
|
|
|
|
|
Kash wrote:
Have I missed something out?
Yep!
MSDN[^]says:
The framework automatically calls UpdateData
with bSaveAndValidate set to FALSE when a modal
dialog box is created in the default implementation
of CDialog::OnInitDialog. The call occurs before
the dialog box is visible. The default
implementation of CDialog::OnOK calls this member
function with bSaveAndValidate set to TRUE to
retrieve the data, and if successful, will close
the dialog box. So you Do not have to call UpdataData() yourself:
void CMyPropPage::OnCallMyDlgButton()
{
CMyDlg ViewData;
if (ViewData.DoModal()==IDOK)
m_Number = ViewData.m_Number;
}
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
yep that works, but when I re-open the dialog box, the changes have been lost. I want to keep the changes fixed and not for it to revert to the constructor values of the dlg box.
kash
|
|
|
|
|
Kash wrote:
I want to keep the changes
Then you can set the desired value before the DoModal() , as palbano suggested.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
CMyDlg ViewData;
ViewData.m_number = 10; // set data to previous value
ViewData.DoModal();
m_viewdatanumber = ViewData.m_number; // capture data from dialog
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
|
|
|
|
|
|
hi all!
how can i read a file line by line using fscanf() in a win32 api program
and then display each line in a text control!
Someone here told to use fscanf() rather than fgets()
(I don't remember who..)
Thanks for any answer!!!
|
|
|
|
|
If you are writing code specific from Windows using the Win32 API, why not use the platform API which encapsulates much more support for file access (especially when wanting to get return codes)? Calls like CreateFile(), WriteFile(), ReadFile() are designed with more functionality (such as DACL support etc) which make it more robust.
With that said, if you really want to use fscanf read this article from MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_fscanf.2c_.fwscanf.asp[^]
If you scroll down there is an example on how to use fscanf. A note though, if you are wanting to read line by line, fgets() may be more appropriate, and you get the control of defining the max size of the buffer you will read at any one time.
Just a thought. YMMV.
Good luck.
- Dana
|
|
|
|
|
When I want to use a COM Interface, like the Microsoft XML DOM Parser I can use the #import keyword (like #import "msxml3.dll" ) and than use the simple Interface Pointer, like IXMLDOMDocumentPtr or IXMLDOMNodePtr .
Ok... but how can I use this method (#import and I???Ptr ) with some other COM Interfaces, like the DirectShow COM Interface?
Where can I found the DLL I have to inlude (#import "xxx.dll" )?
(I have not found a DLL like dshow.dll )
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Actually, what you #import is the type library, which is usually included in the DLL (but can also be a separate).
There's a problem with the DirectX stuff, though: I've already searched up & down for a TLB of it, and couldn't find any (even asking here didn't help ) So unless I missed something, you're basically stuck with the ugly MS header files.
OTOH, there are some DirectX "helper" ActiveX (looks like they are intended for VB et. al.), which expose the core functionality and provide their own TLB. Haven't delved deeper into it, as I was looking for full functionality...
However, maybe someone comes up with some better info, maybe the "DirectX 8 for VB" allows to access the entire model by some clever QueryInterfacing...
If you go to war, you will destroy a great country a stoned greek chick to the richest man of the world
[sighist] | [Agile Programming] [doxygen]
|
|
|
|
|
Watch out a file named interop2.cs in your VS.NET cd. It's a sample which interops the Quartz type-library (DirectShow).
|
|
|
|
|
Thanks!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
The DirectShow engine is in quartz.dll
|
|
|
|
|
Thanks! I will try it!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Okay as an example, instead of having to qualify a path to the type lib, try :
#import "progid:Excel.Application" named_guids
or specifically office 10
#import "progid:Excel.Application.10" named_guids
As an alternative to progid:, you can use libid: where you enter the 128bit UUID
Quote from a clever bloke :
"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones." - Albert Einstein
|
|
|
|
|
Thanks!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Debugging fun with assembly and user dumps:
Hello, I put user dumps in my screen saver last release and have only received 2 so far. I can not figure out how to use the information in the debugger to figure out why my application is crashing though, can anyone help? I have all symbols for the relevant dlls and am running on XP. I open the crash dump and break into it and the data which shows is below.
Questions:
1) It is strange that the crash appears to happen in gluPerspective() and my code is not on the callstack. Does this mean this function is being called before my code is loaded? And why would it crash then?
2) Is there any way to figure out what parameters were passed to void gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar); by looking at the registers or memory? And how would I do this?
If you need any further information including file versions or memory contents just let me know.
UPDATE: I just looked at the other crash dump I received from the same person and it crashes in the exact same spot in assembly as in THREAD1 below, so the problem is repeatable, but doesn't happen that often and I don't have access to the machine the crash happens on.
CRASH ERROR:
0xC0000005: Access violation reading location 0x68fa99b3.
THREAD1
Callstack:
68fa99b3()
-> glu32.dll!_gluPerspective@32() + 0x62
opengl32.dll!_SetCltProcTable@12() + 0xb7
ntdll.dll!77f7ec5c()
ntdll.dll!77f7fe99()
ntdll.dll!77f7cae1()
Assembly at arrow:
68B29ADE fcomp qword ptr [__real@0000000000000000 (68B21110h)]
68B29AE4 fnstsw ax
68B29AE6 test ah,44h
68B29AE9 jnp _gluPerspective@32+0ABh (68B29B45h)
68B29AEB fcos
68B29AED lea eax,[ebp-30h]
68B29AF0 push eax
68B29AF1 fdiv qword ptr [ebp+60h]
68B29AF4 fstp qword ptr [ebp+60h]
68B29AF7 call ___gluMakeIdentityd@4 (68B299B3h)
68B29AFC fld qword ptr [ebp+60h] <==== crash happens here
68B29AFF fld qword ptr [ebp+68h]
68B29B02 lea eax,[ebp-30h]
68B29B05 fdivr st,st(1)
68B29B07 push eax
68B29B08 fstp qword ptr [ebp-30h]
68B29B0B fstp qword ptr [ebp-8]
68B29B0E fld1
68B29B10 fdiv qword ptr [ebp+50h]
68B29B13 fld qword ptr [ebp+70h]
Registers:
EAX = 0012F9D0 EBX = 00000000 ECX = 00000000
EDX = 0000005A ESI = 5ED02E84 EDI = 5ED02DC4
EIP = 68FA99B3 ESP = 0012F8C8 EBP = 0012FA00
EFL = 00010246
CS = 001B DS = 0023 ES = 0023 SS = 0023 FS = 0038
GS = 0000
ST0 = +0.0000000210131446e-4925
ST1 = -2.8092166988494150e-2425
ST2 = +0.0000000000000000e+0000
ST3 = -2.1289153719506332e-3043
ST4 = +0.000002017740e-4933#DEN
ST5 = +7.0710678118654750e-0001
ST6 = +1.3300000429153442e+0000
ST7 = +1.0000000000000002e+0000 CTRL = 027F
STAT = 0020 TAGS = FFFF
OV = 0 UP = 0 EI = 1 PL = 0 ZR = 1 AC = 0 PE = 1 CY = 0
THREAD2:
> 7ffe0304()
kernel32.dll!_Module32NextW@8() + 0x4b
ntdll.dll!_ZwClose@4() + 0xc
dbghelp.dll!6d5360be()
ntdll.dll!_RtlFindNextActivationContextSection@16() + 0x58
ntdll.dll!_RtlFindActivationContextSectionString@20() + 0xda
ntdll.dll!_RtlDosApplyFileIsolationRedirection_Ustr@36() + 0x14e
ntdll.dll!__NLG_Return2() + 0x77f247ef
ntdll.dll!_LdrpUpdateLoadCount3@12() + 0x61
Assembly at arrow:
7FFE02F2 add byte ptr [eax],al
7FFE02F4 add byte ptr [eax],al
7FFE02F6 add byte ptr [eax],al
7FFE02F8 add byte ptr [eax],al
7FFE02FA add byte ptr [eax],al
7FFE02FC add byte ptr [eax],al
7FFE02FE add byte ptr [eax],al
7FFE0300 mov edx,esp
7FFE0302 sysenter
7FFE0304 ret
7FFE0305 mov edx,esp
7FFE0307 syscall
7FFE0309 ret
7FFE030A mov cl,al
7FFE030C call dword ptr ds:[804D4670h]
7FFE0312 mov eax,dword ptr [ebp+10h]
7FFE0315 xor ecx,ecx
7FFE0317 cmp word ptr [eax],cx
7FFE031A mov dword ptr [ebp-4],ecx
7FFE031D je 7FFE0330
Registers:
EAX = 09D40000 EBX = 00000000 ECX = 00000007
EDX = 00000000 ESI = 001692E8 EDI = 00000B40
EIP = 7FFE0304 ESP = 09D3F1BC EBP = 09D3F1F4
EFL = 00000202
CS = 001B DS = 0023 ES = 0023 SS = 0023 FS = 0038
GS = 0000
ST0 = +0.0022079554487745e-3205
ST1 = +0.019398050326e-4933#DEN
ST2 = +0.021580373259e-4933#DEN
ST3 = -0.0000000000003250e+3239
ST4 = +7.5092915116251764e-2221
ST5 = +6.3637260289022832e-0313
ST6 = +0.0000000039399646e-4925
ST7 = -0.0005140979428653e+3107 CTRL = 027F
STAT = 0000 TAGS = FFFF
OV = 0 UP = 0 EI = 1 PL = 0 ZR = 0 AC = 0 PE = 0 CY = 0
|
|
|
|
|
Is he using current video drivers?
You can also trying looking at the stack to see if your program is part of the call stack.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Thanks for the quick response Tim, and yes he has the latest video drivers (that is the first thing I check). It has happened with 2 different video cards on his machine, which is why I am reasonably sure it is not the video drivers.
Here was his config for each crash
Windows: Windows XP 5.1.2600 Service Pack 1
Processor: Original OEM AMD K7 (Unknown model) 1808 MHz
Memory: 511 MB
GL_VENDOR: NVIDIA Corporation
GL_RENDERER: GeForce4 Ti 4600/AGP/SSE/3DNOW!
GL_VERSION: 1.4.0
Windows: Windows XP 5.1.2600 Service Pack 1
Processor: Original OEM AMD K7 (Unknown model) 1809 MHz
Memory: 1023 MB
GL_VENDOR: ATI Technologies Inc.
GL_RENDERER: Radeon 9700 Pro x86/MMX/3DNow!/SSE
GL_VERSION: 1.3.3561 WinXP Release
also glu32.dll (where the crash occurs) is a Microsoft distributed dll which is usually not overwritten by video drivers as far as I know. There is one address (68fa99b3()) above the crash though that may be calling into a driver, I cannot tell.
|
|
|
|
|
Hello,
I have some property pages that change it's content dinamically, once the content of one page (say page 1) gets changed the caption of that page (1) must change its color in order to tell the user that a change in that property page has ocurred.
How can I do it?
Could you give me some guidelines?
Thank you in advance.
|
|
|
|
|
I do not know if this helps, but this links[^] to an article about CPropertySheets.
~RaGE();
|
|
|
|
|
Hello,
I've searched for articles, samples... in codeproject, msdn and in other web resources and I've not been able to find how to do (change the color of ONE tab while the other ones still appear as the standard ones).
The article that you link in your post is a very good article from Mr. Demirhan, but it changes the font of all the tab ctrl (not only of one tab...).
But thank you for your answer...
|
|
|
|
|
Have revisited a C++ program i wrote about 6 years ago. It used the THREED vbx controls. Am now using Visual C++ 6.0 and i can not develop with them as they need a licence. Originally got them from buying the SAMS Visual C++ 1.5 book and CD. Anyway, i decided to replace them with an ocx that is more available. When i did an 'insert activex control', the Microsoft Forms 2.0 controls were available. Had no probs replacing my command buttons and frames but the check boxes have been a nightmare. Then i thought the toggle button might look better and tried it. Still a nightmare. Where my problem lies is in seeing the state of the checkbox and/or toggle button. Thought the following line would differentiate between depressed and not depressed:
if (m_ToggleButton1Control.GetValue == false)
However, it always returns true. i use other properties that work:
{m_ToggleButton1Control.SetForeColor(olive_note);}
The 'value' is defined as a VARIANT of which i can not find any documentation.
Can anyone help???
benny
|
|
|
|
|
bennyrascal wrote:
if (m_ToggleButton1Control.GetValue == false)
Should work, if m_ToggleButton1Control is of type bool (or even BOOL ), and if you used UpdateData (or corresponding message) with parameter TRUE.
~RaGE();
|
|
|
|
|
Thanks
Can't use true as i get a compiler error:
D:\Development\C++\Source\CheckBoxes\CheckBoxesDlg.cpp(195) : warning C4805: '==' : unsafe mix of type 'struct tagVARIANT (__thiscall CMdcToggleButton::*)(void)' and type 'const bool' in operation
When using the class wizard to add a member variable the only choice i have is a category of control and a variable type of CMdcToggleButton. There are no other choices. If i use the standard checkBox then i get the categories of control and of value and the value bit works.
As far as the updatedata, Here is the actual code:
void CCheckBoxesDlg::OnClickToggleButton1()
{
UpdateData(TRUE);
m_ToggleButton1Control.UpdateData(TRUE);
m_ToggleButton1Control.GetValue();
if (m_ToggleButton1Control.GetValue == false)
{m_ToggleButton1Control.SetForeColor(olive_note);}
else
{m_ToggleButton1Control.SetForeColor(red_note);}
}
As you can see i even did the update two different ways as an experiment.
A similar function for a simple checkbox works perfectly:
void CCheckBoxesDlg::OnClickFormsCheckBox1()
{
UpdateData(TRUE);
if (m_FormsCheckBox1Control.GetValue == 0)
{
m_CommandButtonControl.SetForeColor(blue_note);
m_CommandButtonControl.SetCaption("FormsCheckBox set on");
m_FormsCheckBox1Control.SetBackColor(blue_note);
}
else
{
m_CommandButtonControl.SetForeColor(yellow_note);
m_CommandButtonControl.SetCaption("FormsCheckBox set off");
m_FormsCheckBox1Control.SetBackColor(yellow_note);
}
}
Again thanks for any help as i'm baffled.
benny
|
|
|
|