|
The number stored in long m_NumAfterAddRecords is the RecordCount and its 14.
When I display it in my status bar I do:
stringNum.Format("Final Number of Records: %d", pDoc->m_db.m_NumAfterAddRecords);
I get some ridiculous negative number. Is it because I'm doing %d and its a long value? If so, how do you format a long value?
Thanks,
ns
|
|
|
|
|
try
stringNum.Format("Final Number of Records: %ld", pDoc->m_db.m_NumAfterAddRecords);
or
stringNum.Format("Final Number of Records: %d", (int)pDoc->m_db.m_NumAfterAddRecords);
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
Thanks. I found my silly mistake. I'd declared the number of records to be a member variable, but later redeclared it locally to my function, so naturally it wasnt passing any sensible value once it went out of scope. Appreciate the formatting ideas.
ns
|
|
|
|
|
Always suspect of the hexadecimal value 0xcccccccc. Visual C++ in debug mode fills all uninitialized variables with 0xcc to ease spotting these kind of problem...
Concussus surgo.
When struck I rise.
|
|
|
|
|
Friends,
I have created Regulalar DLL with using MFC in statically linked,i have added Dialog box ,and also Microsoft grid control and i buld in release mode ,and i have called from test release application ,the dialog box is not getting displayed eventhough controll is going to DLL ,Ihave observe that when I remove grid control the dilog box is displayed why it is so happening any one know the reason please mail me also give the solution how i could use grid control in the above case
Thanking u
krishnamohan
|
|
|
|
|
It problem about resource handle,you can use dynamically links to MFC and try
AFX_MANAGE_STATE(AfxGetStaticModuleState( ))
see MSDN :
When building a regular DLL that dynamically links to MFC, you need to use the macroAFX_MANAGE_STATE to switch the MFC module state correctly. This is done by adding the following line of code to the beginning of functions exported from the DLL:
AFX_MANAGE_STATE(AfxGetStaticModuleState( ))
The AFX_MANAGE_STATE macro should not be used in regular DLLs that statically link to MFC or in extension DLLs
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
you can use SetResourcehandle()reset the application current resourcehandle.
(use GetResourceHandle() save the old resource handle first)
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
IF i just want the same function to run for each button when clicked in an array of buttons, how do I do this?
Thanks,
ns
|
|
|
|
|
use ON_CONTROL_RANGE macro,you sould add it manualy
ON_CONTROL_RANGE( wNotifyCode, id1, id2, memberFxn )
wNotifyCode can be BN_CLICKED
id1 is the first button control ID and id2 is the last button control ID,All IDs must be consecutive.
message handler declare:
afx_msg void memberFxn(UINT uID);
uID is the button control ID
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
ON_CONTROL_RANGE is dangerous because it's easy enough for control ids to get out of range once you start modifying your dialog. This can cause hard to detect errors.
I prefer to let ClassWizard generate separate handlers (OnButton1, OnButton2, ...). I then manually replace them with a single handler. Easy enough to do and independent of the control ids.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Or buttons or labels etc.
At runtime I find out how many controls i need (thse are CEdits). How by code can I create these? I've only done them so far with the toolbox at designtime. So how does one create a CEdit array dynamically?
Thanks,
ns
|
|
|
|
|
From MSDN:
CEdit* pEdit = new CEdit;
pEdit->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,
CRect(10, 10, 100, 100), this, 1);
For others you have to do the same.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Hello,
I was wondering if anyone knows how to clear the screen in a Visual C++ Console Application.
I need to be able to do this for a part of a project in my C++ course. My lecturer doesn't even know how to clear the screen. He just suggested using lots of "\n", but there has to be a better way??
Thanks.
_______________________________________
Web: www.jcroucher.com
Sonork: 100.472
ICQ: 25902350
MSN: jcroucher@yahoo.com
Yahoo: jcroucher@yahoo.com
----------KnOwLeDgE iS pOwEr-----------
|
|
|
|
|
Well, this does work:
void ClearScreen()
{
int i;
for(i = 0;i < 24;i++)
{
cout << "\n";
}
}
I think there is another way, however I haven't seen it for a long time, maybe someone else can post as I am curious now that you bring the subject up.
Nick Parker
|
|
|
|
|
Yeah that does work but the prob is that any new text placed on the screen will start at the bottom of the screen.
I did find this code that is suposed to work but its not clearing the screen.
#include <stdlib.h>
system("CLS");
However i did change "CLS" to "color 6" and it did change the font color. It just the CLS command thats not working.
_______________________________________
Web: www.jcroucher.com
Sonork: 100.472
ICQ: 25902350
MSN: jcroucher@yahoo.com
Yahoo: jcroucher@yahoo.com
----------KnOwLeDgE iS pOwEr-----------
|
|
|
|
|
Found it!
That code does work. I didn' have endl. For some reason the system("cls") doesnt get executed without the endl.
#include <stdlib.h>
cout << "Before\n" << endl;
system("cls");
cout << "After\n";
_______________________________________
Web: www.jcroucher.com
Sonork: 100.472
ICQ: 25902350
MSN: jcroucher@yahoo.com
Yahoo: jcroucher@yahoo.com
----------KnOwLeDgE iS pOwEr-----------
|
|
|
|
|
endl is equal to:
putc('\n');
flush();
prolly the flush is the responsible here.
Concussus surgo.
When struck I rise.
|
|
|
|
|
Hello,
I have a View that's derived from a CListView--with an implicit CHeaderCtrl:
class CGoalsListView : public CListView
However, when I use the class wizard to create handlers Header notifications (e.g., HDN_ENDDRAG), the handlers are never called. The Class wizard put in ON_NOTIFY_REFLECT macros for these controls. I'm wondering if I'm in messaging hell because of my heterodox behavior of getting my main view from CListView instead of CView? Does anyone have any suggestions on how I can find the notifications from my CHeaderCtrl?
Oh---also, how can I change my Header Control's style?--the MSDN alludes to it but doesn't give the exact function (suggests "further reading").
thanks!
JennyP
|
|
|
|
|
I found all I needed on this site! (Should have checked here first.)
http://www.codeproject.com/listctrl/headerctrl.asp
Thanks!
JennyP
|
|
|
|
|
I do that all the time...
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hi all,
Does anyone know of a way to specify the position in which a popup message box will appear on screen? I am currently using AfxMessageBox for all my popups, but cannot see any way to force this to pop in a particular location, rather than always displaying in the center of the screen.
Any help would be greatly appreciated...
Thanks,
Steve.
|
|
|
|
|
|
I have custom html text in CString and I should show it to user. Please help me. I think I should use IWEBBrowser2, but it work with url or file.
|
|
|
|
|
i was trying to do this too, a few months ago. i gave up and just write the HTML to a temp file.
-c
Conservative:
One who admires radicals centuries after they're dead.
-- Leo C. Rosten
|
|
|
|
|
I know how to do this once you have the IHTMLDocument2* . My awareness of IWebBrowser2 is minimal. But if you can get the IHTMLDocument2* then here is some code :-
HRESULT hr;
SAFEARRAY* psa = SafeArrayCreateVector(VT_VARIANT, 0, 1);
VARIANT *param;
BSTR bsData = m_html.AllocSysString();
hr = SafeArrayAccessData(psa, (LPVOID*)¶m);
param->vt = VT_BSTR;
param->bstrVal = bsData;
hr = pDoc->write(psa);
hr = pDoc->close();
SysFreeString(bsData);
SafeArrayDestroy(psa);
By the way try this to get the IHTMLDocument2*
Use the IWebBrowser2::Document property to get an IDispatch interface pointer. Call QueryInterface on this to get the IHTMLDocument2* . I am not good at COM, so my method might be wrong, but try it anyway
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|