|
|
Hi !
I'm building an ATL App with VC++ 6.0.
I added a dialog in my app with the 'Insert->New ATL Object->Miscellaneous->Dialog'.
Then, using the resources editor, I put in this new dialog a CListBox control.
Then, during the InitDialog, I try to add strings to this CListBox control using :
CListBox* pList=(CListBox*)GetDlgItem(IDC_LIST);
pList->AddString("hi");
It compiles fine, but when I run it, I get an assertion failure at the line 'AddString'.
Anyone could help me ?
Thank you !
Jerome
|
|
|
|
|
Hi,
I tried ATLCONTROLS.H ( or whatever name), to get the sugar control classes, but I had some problems as well, have you tried, the "attach" method to attach the HWND.
I rather use, ::SendMessage stuff, when you get used to it it´s not so bad, the message for adding one string is:
LB_ADDSTRING
So something like:
SendMessage(
(HWND) hWnd,
LB_ADDSTRING,
(WPARAM) wParam,
(LPARAM) lParam
);
HTH
Braulio
|
|
|
|
|
Hi,
How do we minize a dialog at the startup i've tried to use
showwindow(SW_MINIMIZE)
in the initdialog but with futile results has anyone done this before will be grateful for any help
Thanks.
|
|
|
|
|
The easiest way is to create the dialog with the WS_MINIMIZE style. One way to do this is to add this style to the dialog template. You may need to edit the .rc file directly in order to do this.
--------
I don't think that I'm a sell-out but I do "Enjoy Coke!"... -- Bloodhound Gang, The Inevitable Return Of The Great White Dope
|
|
|
|
|
Oops! i checked it out an it hasn't worked. or may be is there a way to hide the dialog at the statup.
|
|
|
|
|
Yes, I'm still fumbling around with the basics of MFC. I've got a CSettings class of which I declare an instance "settings" as a member of CMyApp.
So I've got:
class CMyApp : public CWinApp<br />
{<br />
public:<br />
CSettings settings;<br />
}<br />
When someone selects Settings... from the menu, the framework calls CChildView::OnFileSettings().
How can I access the settinngs I've got stored in CMyApp::settings ? AfxGetApp() just returns a pointer to the base class, CWinApp.
Confused.
- Jason
(SonorkID 100.611)
"I just recieved an email from myself but I didn't send it ?"
- Colin Davies, Sonork conference
|
|
|
|
|
Well, there's probably a global variable named theApp around somewhere, otherwise just cast the return value of AfxGetApp() to a CMyApp* [edited: yeah, forgot about the <> thing):
CMyApp* pApp = static_cast<CMyApp*>(AfxGetApp());
--------
I don't think that I'm a sell-out but I do "Enjoy Coke!"... -- Bloodhound Gang, The Inevitable Return Of The Great White Dope
|
|
|
|
|
Just do this ...
CMyApp * pApp = (CMyApp*)<code>AfxGetApp()</code>;
Best regrads,
Eugene Pustovoyt
|
|
|
|
|
The cast of the AfxGetApp will work but I think its a problem of the architecture. Why you should one (of many) CChildView objects modify an element of the app?
IMHO: delete the "CChildView::OnFileSettings()" and create the OnFileSettings() -Message-Handler in the Mainframe or App class.
|
|
|
|
|
I use COXHyperLink from Dundas Ultimate Toolbox to display two links. In Win2K/XP I have following problem: by default, this OS hides underlied letters on buttons/menus (these letters used for quick access with Alt, for example &Close). When I press Alt key, captions became underlined. COXHyperLink uses subclassing of static control.
TROUBLE:
After Alt pressing hyperlink disappears, and only gray background is visible. How can I fix the problem by myself?
See image here
|
|
|
|
|
Hi there,
I have tested the latest version of this class, and I was not able to replicate the issue you have indicated. I was also not able to view the image you have linked to, please contact Dundas Tech Support, lets work together to locate and resolve this issue.
Peter
Dundas Technical Support
|
|
|
|
|
=======================================================
Win32 Debug
-------------------------------------------------------
Generating Code...
Linking...
Creating browse info file...
AhMan_Language_Swap.exe - 0 error(s), 0 warning(s)
========================================================
========================================================
Win32 Release
-------------------------------------------------------------
Linking...
msvcrt.lib(MSVCRT.dll) : error LNK2005: _sprintf already defined in LIBCMT.lib(sprintf.obj)
msvcrt.lib(MSVCRT.dll) : error LNK2005: __itoa already defined in LIBCMT.lib(xtoa.obj)
msvcrt.lib(MSVCRT.dll) : error LNK2005: __setmbcp already defined in LIBCMT.lib(mbctype.obj)
msvcrt.lib(MSVCRT.dll) : warning LNK4006: _sprintf already defined in LIBCMT.lib(sprintf.obj); second definition ignored
msvcrt.lib(MSVCRT.dll) : warning LNK4006: __itoa already defined in LIBCMT.lib(xtoa.obj); second definition ignored
msvcrt.lib(MSVCRT.dll) : warning LNK4006: __setmbcp already defined in LIBCMT.lib(mbctype.obj); second definition ignored
Creating library Release/AhMan_Language_Swap.lib and object Release/AhMan_Language_Swap.exp
Release/AhMan_Language_Swap.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
AhMan_Language_Swap.exe - 4 error(s), 3 warning(s)
==============================================================
Why error in release compile but not in debug compile
|
|
|
|
|
Try to change the setting :
From the VC++ menu:
Project -> Settings...
Go to C/C++ tab, choose "Code generation" category.
Try other choices listed in "Use run-time library:",
for example: Debug ones or non debug ones, DLL ones or non DLL ones.....
Maxwell Chen
People say "No news is good news". Then, no code is good code!?
|
|
|
|
|
How can i turn off the little blinking cursor in console c++?
i have a text game that is a big loop and the game field is stored to an array that is outputted, but when its run on slow computers u can see the cursor moving down in row in the array, is there a way to turn this off?
i asked a while back and Nish kindly gave me this code:
char abc[128];
int main(int argc, char* argv[]){
HANDLE h;
h= CreateConsoleScreenBuffer(GENERIC_WRITE|GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,CONSOLE_TEXTMODE_BUFFER,NULL);
SetConsoleActiveScreenBuffer(h);
CONSOLE_cursor_INFO cci;
cci.dwSize = 90; cci.bVisible=false;
SetConsolecursorInfo(h,&cci);
cin >> abc;
but i couldn't get it to work within my specific program,
can anyone help me out?
-ryan
|
|
|
|
|
After you check the case of some stuff there (struct name and function name), this code works as-is.
|
|
|
|
|
Ok THis should be really easy, but as you all know frustration is the number one killer of compurter keyboards, so i've given up.
I have a loop that refreshes a OpenGl screen rendering contect.
What is the easiest and most reliable way to measure the the time taken to run through the loop I.E FPS. What time functions can I use to get the elapsed time in ms.
Thank you.
|
|
|
|
|
The highest resolution timer that you can get is from a call to QueryPerformanceCounter. If you divide the result from this value by the result you get from QueryPerformanceFrequency, you will have a value in milliseconds.
Not all machines have access to a performance counter, therefore your next best choice is the multimedia counter. You can access this with a call to timeGetTime.
There is a really good timer function that is written inside of a set of DirectX utility classes in the SDK. It can be found in the samples/multimedia/Common/src folder and it is the dxutil.cpp file.
Also in the d3dutil.cpp file of the same directory there is some good code to generate the fps for a render sequence.
Good Luck!
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Thanks I am now using QueryPerformanceCounter
Works good. Max fps is 30 Min 12
|
|
|
|
|
kilowatt wrote:
Not all machines have access to a performance counter
Is this really true? I've heard it before, but I've actually never found a machine that lacks them.
What are they using? Why whouldn't they be available?
Please also note that the highest resolution "timer" you can get is the IA32 rdtsc instruction, though it's not strictly a "timer".
|
|
|
|
|
you could also use the ZEN timer class which makes use of the timer chip on your motherboard.
you can take the code from Michael Abrash's Graphics Programming Black Book, Special Edition
or
Michael Abrash's Zen of Code Optimization
according to my knowledge thats as far as you can get since it is dependent on the clock frquency your hardware is using.
Best of luck.
|
|
|
|
|
vijayaramaraju wrote:
Michael Abrash's Graphics Programming Black Book, Special Edition
or
Michael Abrash's Zen of Code Optimization
both truly awesome books
"... and so i said to him ... if it can't dance and you can't eat it either f**k it or throw it away" 8028finder.com
|
|
|
|
|
I am currently working on the Window Media skins for my SDI application.
Skins can be Winamp skin also. Can someone advise me of this?
|
|
|
|
|
Every time I try to create an image object with a JPEG file, i get OutOfMemory status. The documentation says that a constructor can throw this error for other reasons even though you may have plenty of free memory on your machine.
Anybody ran into this issue??
Thanks.
---
Softomatix
http://www.pardesiservices.com/Softomatix.asp
|
|
|
|
|
hello,everyone:
help me . Is there anyone can tell me how to implement "Program Rollback"?
The key question is how to save the Program state at any time ,and how to restore the program state using C or C++.
|
|
|
|