|
Mmm. Just looked at that. It uses a method similar to the one I was avoiding by guessing how many might fit, then decreasing/increasing the length of the string until it fits best. Oh well, looks like that's the way to go.
"The way of a fool seems right to him, but a wise man listens to advice" - Proverbs 12:15 (NIV)
|
|
|
|
|
how do i get the font name used by the system ,or more precisely i need to fill the LOGFONT structure how do i do.
thanx in advance
Farpointer
|
|
|
|
|
You can use the ::GetStockObject function.
If using MFC, the code would be
LOGFONT logFont;
CFont *pFont = CFont::FromHandle((HFONT)::GetStockObject(SYSTEM_FONT));
pFont->GetLogFont(&logFont);
HTH,
K.
The great error of nearly all studies of war has been to consider war as an episode in foreign policies, when it is an act of interior politics - Simone Weil
Fold with us! ¤ flickr
|
|
|
|
|
thanx man i will see to it
farpointer
|
|
|
|
|
Hello , I am new to MFC.
I am using MS Access database .
I want to get tables list using CDatabase.
Is there ant SQL Query for getting table names from Access database.
I used this code but I am getting errors.
CDatabase db;
CString sDriver = "MICROSOFT ACCESS DRIVER (*.mdb)";
CString sFile= "c:\\mydabase.mdb";
sDsn.Format("ODBC;DRIVER={%s};DSN='MyDsnName';DBQ=%s",sDriver,sFile);
db.Open(NULL,false,false,sDsn);
CRecordset recset(&db);
recset.Open(CRecordset::forwardOnly,sql,CRecordset::dynaset);
CString s=recset.GetTableName();
//int n=recset.GetRecordCount();
MessageBox(s);
========
Here I am not getting table name
Plz Give reply soon .
Praveen.
Praveen
|
|
|
|
|
Does the database and the DSN exist?
parims wrote:
I used this code but I am getting errors.
And what would those errors be?
parims wrote:
sDsn.Format("ODBC;DRIVER={%s};DSN='MyDsnName';DBQ=%s",sDriver,sFile);
It looks like you are trying to create both a DSN and a DSN-less connection. Why?
parims wrote:
recset.Open(CRecordset::forwardOnly,sql,CRecordset::dynaset);
What is the value of sql ?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hello Friends
Can anybody help me out in knowning how to configure Windows Update.
I want that at a stipulated time the Automatic Update should start on its own
On a fixed time
With Rgds
VC++
|
|
|
|
|
vcforums wrote:
Can anybody help me out in knowning how to configure Windows Update.
You mean by using the Control Panel applet:
rundll32.exe shell32.dll,Control_RunDLL wuaucpl.cpl
Or something else?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
yes Mr.David
I mean by going through wuaucpl.cpl
I am setting a option for the specified time to get the updates started
but it fails to do the same
Any help on this.
With Rgds
VC++
|
|
|
|
|
Wuauclt.exe operates on the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
hi
Thanks very much for been so patient for my so small query thanks once again,
but could u tell me what could be the reason if even setting these registry values,the update fails to occur,
Any suggesstion are welcome sir
With Rgds.
VC++
|
|
|
|
|
Could it be that no updates are available?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Thanks very much for ur reply at lightning speed,thanks for lthat
If u don't mind can i have ur mail id,
bcoz i have seen most of my reply from code project have come from u
If u remeber i have posted previously and got reply from u on questions such as
how to detect os remotely
Trapping system idle time in mfc
and now windows update
i can have ur id i will be obliged,
With Rgd
[VC++]
vcforums@gmail.com
|
|
|
|
|
I am a newbie to vc++. I did some C 15 years ago... but, normally, I'm a vb.net guy. However, my current job is VC++ and my boss wants me to place a class inside a .h and .cpp file that already has an existing class. I did this fine but when trying to define an instance of this class from another class, it seems invisible even though I have included the .h file.
Here's my code:
file1.h
class Class1
{
// definitions here
};
class Class2
{
// definitions here
};
File1.cpp:
#include "file1.h"
Class1::SomeFunction()
{
}
Class2::AnotherFunction()
{
}
File 2.h
#include "File1.h"
class Class3
{
Class2 cClass2; // not visible.
};
Any ideas?
Bill Dennis
Orlando, FL
|
|
|
|
|
Are you using namespaces in file1.h ?
What extactly do you mean by 'not visible' ?
Are there some compiler errors ?
Horror and moral terror are your friends. If they are not then they are enemies to be feared.
|
|
|
|
|
No, no namespaces. Boss doesn;t want to use namespaces.
Getting undefined class error when compiling on the line where I am insantiating a new class variable:
Class2 cClass2;
Bill Dennis
Orlando, FL
|
|
|
|
|
are you sure you're not having trouble with the class name ??
be careful, C/C++ is case sensitive (unlike VB/VB.NET)...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
|
Maybe there is a conflict between some #define directives
#ifndef DONT_INCLUDE_TWICE
#define DONT_INCLUDE_TWICE
class Class1
{
};
#endif
#ifndef DONT_INCLUDE_TWICE
#define DONT_INCLUDE_TWICE
class Class2
{
};
#endif
If DONT_INCLUDE_TWICE is already defined, the definition of Class2 will be skipped.
Maybe you can post your header files here...
Horror and moral terror are your friends. If they are not then they are enemies to be feared.
|
|
|
|
|
but if that was the problem, he would have an error such as "Class already defined"...
but the compiler says that the class is NOT defined, even with the header include...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
billiam904 wrote:
Boss doesn;t want to use namespaces.
Then don't tell him/her that you can't get away from using the global namespace!
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Wish I could. He wants me to do it the way he tells me to do it.
Would I have to include the .NET framework if I use namespaces?
|
|
|
|
|
Bill Dennis wrote:
Would I have to include the .NET framework if I use namespaces?
No. Namespaces have nothing to do with the .NET framework. It's just the name of a declarative region in your code. All programs use (or have use of) the global namespace. If you use STL, you will see references to the std namespace.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I just put your three files into an existing project and it compiled fine. The problem must lie with code that has not been shown.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I am attempting to paste some code here but due to contract restrictions, I can't paste it all.
sharewaredlg.h:
#if !defined(AFX_SHAREWAREDLG_H__609C8E03_67C4_11D3_A859_00000E00ECA4__INCLUDED_)
#define AFX_SHAREWAREDLG_H__609C8E03_67C4_11D3_A859_00000E00ECA4__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "RegisterDlg.h"
#include "WavRead.h"
class CSharewareDlg : public CDialog
{
};
class CDemoAudio
{
private:
CWavRead m_cWavRead;
public:
BYTE *ReadDemoIntoBuffer();
void PlayBuffer(BYTE *pDemoBuffer, WAVEHDR *hdrDemo, DWORD dwDataBufferSize);
BYTE *GetDemoBuffer();
DWORD GetDemoSize();
protected:
// variables
DWORD dwOutDataSize;
BYTE* m_pbyDemoBuffer;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SHAREWAREDLG_H__609C8E03_67C4_11D3_A859_00000E00ECA4__INCLUDED_)
SingleDlg.h:
#if !defined(AFX_SINGLEDLG_H__B2588407_6984_11D1_A856_444553540000__INCLUDED_)
#define AFX_SINGLEDLG_H__B2588407_6984_11D1_A856_444553540000__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// Shareware stuff
#include "SharewareDlg.h"
struct THREADPARMS_RECORD
{
CWnd *pWnd;
CSingleAlg *pckSingleAlg;
CWavWrite *pWavWrite;
CWavRecord *pWavRecord;
// BD 10/05 ADDED PARM FOR CWAVREAD
CWavRead *pWavRead;
// BD 10/05 ADDED DEMO PARMS.
CDemoAudio *pDemoAudio; // error here undefined class.
BYTE *pbyDemoBuffer;
int *pnRegLevel;
// =========================
BYTE *pbyBuffer;
int *pnBufferSize;
CString *pstrCurFile;
CString *pstrCurFilePath;
CEvent *pEvent;
CCriticalSection *pCriticalSection;
int *pnStop;
};
class CSingleDlg : public CDialog
{
protected:
// Program variables
CSingleAlg m_ckSingleAlg;
CWavWrite m_cWavWrite;
CWavRecord m_cWavRecord;
CWavRead m_cWavRead;
// =========DEMO====================
// Demo variables BD 10/05
CDemoAudio m_cDemoAudio; // Error here. m_cDemoAudio utilizing Undefined class.
// =================================
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SINGLEDLG_H__B2588407_6984_11D1_A856_444553540000__INCLUDED_)
|
|
|
|