|
I want to post the number of recipes I have in a database but when i run the recipe count function i get giberish in the message box.
question: how can i post a interger in the message box?
info: MFC SDI with database support
int count=0;<br />
CString post="";<br />
<br />
m_pSet->MoveFirst();<br />
<br />
while(m_pSet->IsEOF == FALSE)<br />
{<br />
m_pSet->MoveNext();<br />
count++;<br />
}<br />
<br />
post=count;<br />
<br />
MessageBox(post);
thanks
|
|
|
|
|
CShoun wrote:
post=count;
MessageBox(post);
Change
post=count;
to
post.Format("%d", count);
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
I have placed a webcontrol on CFormView in a SDI application.I have assigned it a member variable m_webbrowser.
Also i have got a dilogbox derived from Cdialog in my application.
I need to access this m_webbrowser from my dialogbox.
Please let me know how to do it
|
|
|
|
|
When the dialog object is instantiated, pass it a pointer to the m_webbrowser variable.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Since I've included a MFC-based dialog in the DLL I am developping, icons that were displayed in a toolbar have disappeared. These icons are managed with Windows API :
tbab.hInst = MaDLL::hInstance ;
tbab.nID = IDB_ICONE_OBM ; // icon id in ressources
val = SendMessage (hwndToolbar, TB_ADDBITMAP, 1, (LPARAM)&tbab) ;
This code worked fine until I have included my dialog box and MFC lib
|
|
|
|
|
It could be that your IDB_ICONE_OBM is conflicting with other resource ID in resource.h. Remove the duplication if there is.
(You can also use the ResOrg , a small utility written by one of the CPians to resolve the ID conflict.)
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hi,
currently I’m migrating a VB program to VC++ 6.0. Some functions in the VB program are called by the function Keys (F2-F12). This function should be in the new program too. My problem is, that I don’t know how to do this. in VB its just the "OnKeykDown". Is there an easy possibility to route the messages from the control which has the focus to the Dialog???
Thx
btw: Sorry for bad english
|
|
|
|
|
Are you using the MFC ? If yes, go to the resources tab and there you have the accelerator resource. For each key you want to be used, create a new unique message id (if required) and then add the accelerator with it's associated Id.
Then with ClassWizzard, add a function for each message ID.
Hope this helps
|
|
|
|
|
This doesn't work if you have a Dialog App, but it works in SDI with FormView. So I do it so.
Thanks 4 help
|
|
|
|
|
In the dialog's constructor, you'll need to call LoadAccelerators() . Then you'll need to override the PreTranslateMessage() method like:
BOOL CMyDlg::PreTranslateMessage( LPMSG pMsg )
{
if (NULL != m_hAccelTable)
{
if (::TranslateAccelerator(m_hWnd, m_hAccelTable, pMsg))
return(TRUE);
}
return CDialog::PreTranslateMessage(pMsg);
}
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thats it! Now it works even in a Dialog. Thanks!
|
|
|
|
|
Hi I am controlling an electrical circuit using the computer through the computer ports. I am trying to capture a fast changing analog signal using sampling. So I am just enquiring about the maximum frequency that we could set the timer to using the following function:
SetTimer(1, 2000, 0);
I actually want the timer to interrupt every ten micro seconds (10uS). Is it possible with this type of timers. If not, can anyone guide me to a timer that is capable of doing so.
Thanx in advance
|
|
|
|
|
Timers are set in milliseconds and therefore do not have the resolution you require.
I suggest that you use another thread to do this work. You could then use the high-resolution performance counters QueryPerformanceCounter() and QueryPerformanceFrequency() to monitor the time.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Are these actually counters or are they functions that retrieve the frequeny and index of a counter?
Check out this link plz.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers/timerreference/timerfunctions/queryperformancefrequency.asp
|
|
|
|
|
I was suggesting that you uses the performance counter functions in order to write your own high-resolution timer.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Ahhaaa.. Ok then, but these are useful functions as well, Thanx Ant.;)
|
|
|
|
|
I created a simple user control in C# which has a button in it.
//DemoControl.cs
namespace DemoControl
{
public class UserControl1 : System.Windows.Forms.UserControl
{
private System.Windows.Forms.Button button1;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public UserControl1()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// TODO: Add any initialization after the InitComponent call
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
}
#region Component Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(16, 16);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(88, 32);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// UserControl1
//
this.Controls.Add(this.button1);
this.Name = "UserControl1";
this.Size = new System.Drawing.Size(608, 248);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.UserControl1_MouseMove);
this.ResumeLayout(false);
}
#endregion
}
}
The i created an MFC ActiveX control to host the C# control
//HostCtrol.cpp
int CMfcHostCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (COleControl::OnCreate(lpCreateStruct) == -1)
return -1;
AfxEnableControlContainer();
DemoControl::UserControl1* pcal = new DemoControl::UserControl1();
CComPtr<iunknown> spunkControl;
spunkControl.Attach((IUnknown*)System::Runtime::InteropServices::Marshal::GetIUnknownForObject(pcal).ToPointer());
CRect rectPlaceHolder;
GetClientRect( &rectPlaceHolder );
m_ctrl.Create(spunkControl, WS_VISIBLE | WS_TABSTOP, rectPlaceHolder, this, 0);
return 0;
}
where m_ctrl is CWinFormsControlWnd class which i downloaded from the MSDN Magazine at http://msdn.microsoft.com/msdnmag/issues/03/03/WindowsForms/default.aspx
It works great, but the hosting application stuck when i press the button.
Does anyone knwos whats wrong?
Amir.
Amir Harel
|
|
|
|
|
I have been trying to make a library to convert VB code to C++. Incase you feel you need something like this please visit http://ezbasic.sf.net/
I will try and post an article about the library on CodeProject if I get enough people who are interested in the project.
Regards,
Vivek Jishtu
|
|
|
|
|
Eeeeeeeeeeeek....
Err, what are the advantages of doing this ?????
|
|
|
|
|
Well quite a few months of effort has gone into the project. And to get something like this as a comment is not the best way of starting things.
|
|
|
|
|
Sorry, that was not my purpose to offense you. There must surely be a lot of work and lot of efforts behind this... But personally I think VB is not enough structured to be a good programming language, so you can make things without understanding what you are really doing... And when mixing it with C++, I think you will loose the benefits of C++ programming (that is have access to almost everything you want).
|
|
|
|
|
Um, I suppose for academic purposes this is quite interesting to do. What do you plan to do with the project?
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Any one ready to buy the idea
It is just an experiment I was trying out to see if something like this could be done. I love programming in BASIC and wanted functions that I used in BASIC in C++.
|
|
|
|
|
hi !
hi,
generally according to msdn, CreateMsgService has two return favlues, S_OK and MAPI_E_NOT_FOUND. Well i used mapi to create a new imail service.I am adding the service to a new profile that i am creating.In some machines it is working perfectly.In some others however there is an error.Note that MAPI is initializing properly and the profile is getting created.However CreateMsg service ( return type hr ) is returning failure , but the failure code is NOT MAPI_E_NOT_FOUND. I have checked that the necessary entries in MAPISVC.inf file is there and the two .dll files , minet32.dll and inetab32.dll is also there.any idea why this error could have occured ?
Actually the original .inf file in that machine didn't jave the entries.So i took the .inf file of a different machine..and put it there.Does that make it a problem ?
Kane
"Some guys hack just to get themselves a girlfriend.What a pathetic reason , huh?"
|
|
|
|
|
Dears:
I've upset problem in my ISAPI filter, when i adding this bulk of Code on
OnPreprocHeaders() fucntion , when i open the page the IIS is crashed
with the following error message:
Microsoft Visual C++ Debug Library:
****************************
Debug Error!
Program : C:\Windows\system32\inetsrv\inetinfo.exe
This application has requested the runtime to terminate it in an unusual
way.
Please contact the application's support team for more information
(Press Retry to debug the application)
[Code]
CDatabase dbConnection;
dbConnection.Open("ODBC;DSN=MyDSN;server=mosaicserver;uid=sa;pwd=;database=U
sers");
CRecordset dbRecord(&dbConnection);
//SQL Select Statement
char Sql[1024] = "SELECT ClientID FROM Clients WHERE ClientID = '";
strcat(Sql,"000000000402");
strcat(Sql,"'");
dbRecord.Open(CRecordset::forwardOnly,Sql,CRecordset::none);
//I just dump to file to indicate the process is done well
CStdioFile file("C:\\name.txt",CFile::modeWrite | CFile::modeRead);
file.WriteString(Sql);
file.WriteString("\n--------------------\n");
SetFilePointer(file.m_hFile,0,0,FILE_END);
file.Close();
I Execute above bulk of as separate MFC Dialogue application and run without
any problems ,,Why the ERROR occured in ISAPI??
Best Regards
|
|
|
|