|
Or lseek() to end of the file or ftell() for the old fashioned streams.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
GetFileSize() comes to mind.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks everyone. GetStatus worked.
|
|
|
|
|
I'm not an MFC guru so plrease don't laugh if my question is stupid.
I've created my project with IE.4 Rebar support. I have created class for rebar dialog (i called it CMessageDialog). Then I drag and drop a push button on the rebar and created the function to handle clicking on it.
The problem is that when i launch my application the button is inactive. Please help.
|
|
|
|
|
Have you added code to Enable the command?
eg.
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
...
ON_UPDATE_COMMAND_UI( ID_KB_TAB_BAR_POS, OnUpdateDocumentTabBarPos )
END_MESSAGE_MAP()
void CMainFrame::OnUpdateDocumentTabBarPos( CCmdUI* pCmdUI )
{
pCmdUI->Enable( TRUE );
}
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
What is ID_KB_TAB_BAR_POS ? I don't have anything like that.
|
|
|
|
|
Replace this with the #define for the ID of the your toolbar button. Likewise change the function name to something appropriate. These were just pulled out of code of mine.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
Should it be defined at the CMainFrame class or class of my toolbar dialog? Also in Class Wizzard the are only 2 messages available for my button: BN_CLICKED and BN_DOUBLECLICKED. Thank you in advance.
|
|
|
|
|
It should be in whatever class the code you want to execute upon button press lives. See the various Help topics on ON_UPDATE_COMMAND_UI for more info.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
Dear all,
I'm trying to write an ODBC Driver DLL. I register it with
SQLInstallDriverEx and Implement "ConfigDSN" and "SQLConnect". With
"SQLConfigDataSource" i register Some Data source( ds1 ), but if I try to
connect via "SQLConnect" ODBC's "SQLGetDiagRec" return "Driver Doesn't
support this function" !?!?.
I found my DSN ( ds1 )in ODBC Data sources in Control Panel, and when i open
it, ODBC shows an error message "Driver's ConfigDSN : Component not found in
registry". But in registry in "ODBCINST" I have "ConnectFunctions=YNN" which
mean that I support "ConfigDSN" !?!. The same situation after reinstal MDAC.
My DLL's functions work fine if i load dll with "Afx/LoadLibrary".
What is Wrong?
Win2000 SP3, MDAC 2.8
--------------------
Here is my Driver String which i use to register my Odbc driver:
LPCTSTR pszDriver =
_T("MyDriver\0DRIVER=MyDriver.dll\0SETUP=MyDriver.dll\0SQLLevel=1\0FileUsage=0\0DriverODBCVer=01\0ConnectFunctions=YNN\0APILevel=2\0CPTimeout=60\0\0");
SQLInstallDriverEx(pszAttributes ,NULL, szLoc, FILENAME_MAX, &nLocLen,
ODBC_INSTALL_COMPLETE, &nUsageCount );
--------------------
Here is my sample code for Connection
----------------------
rc = SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&henv);
rc = SQLSetEnvAttr(henv,SQL_ATTR_ODBC_VERSION,(SQLPOINTER)SQL_OV_ODBC3,0);
rc = SQLAllocHandle(SQL_HANDLE_DBC,henv,&hdbc);
rc = SQLConnect(hdbc,(SQLCHAR*) "ds1", SQL_NTS, (SQLCHAR*) "", SQL_NTS,
(SQLCHAR*) "", SQL_NTS);
----------------------
Regards :
KalliMan
a
|
|
|
|
|
I want using VC++ to read/write an object of MyClass from/to a file. I've write
CFile myFile;
...
myFile.Write((char*)&myObject, sizeof(myObject));
So in my file there is a stranger string
How can I do properly?
I'm a beginning of programing.
Please help me!
Best regard!
|
|
|
|
|
Hi,
You cann't write directly class into File. You must use Serialization, and serialize each memeber from your class. See the sample below and look into MSDN for more Info.
class CPerson : public CObject
{
public:
DECLARE_SERIAL( CPerson )
// empty constructor is necessary
CPerson(){};
CString m_name;
WORD m_number;
void Serialize( CArchive& archive );
// rest of class declaration
};
void CPerson::Serialize( CArchive& archive )
{
// call base class function first
// base class is CObject in this case
CObject::Serialize( archive );
// now do the stuff for our specific class
if( archive.IsStoring() )
archive << m_name << m_number;
else
archive >> m_name >> m_number;
}
a
|
|
|
|
|
I've got the error:
error LNK2001: unresolved external symbol "public: virtual struct CRuntimeClass * __thiscall CStudent::GetRuntimeClass(void)const " (?GetRuntimeClass@CStudent@@UBEPAUCRuntimeClass@@XZ)
Please help!
|
|
|
|
|
|
thanks all!
|
|
|
|
|
hello everybody,
(i repost a previous post, but if someone could answer usefully... thx in advance)
i use the following code :
HICON hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_PREVIEW));
CButton* pButton = (CButton*)GetDlgItem(IDC_PREVIEWFACT_BTN);
pButton->SendMessage(BM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)hIcon);
this code is supposed to set the IDC_PREVIEWFACT_BTN button face with the IDI_PREVIEW icon.
the icon is 16x16 pixels, and the button is bigger (in pixels) than my icon (i cannot say how wuch, because the resource editor don't "speak" in pxls).
my problem is that the ison displays quite "well", except the fact that is is much bigger than the button (so truncated).
does anyone know how to display the icon to its real size ?
thanks in advance...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
From the MSDN docs on LoadIcon:
[quote]
LoadIcon can only load an icon whose size conforms to the SM_CXICON and SM_CYICON system metric values. Use the LoadImage function to load icons of other sizes.
[/quote]
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
thank you very much.
i did not notice this detail, but it works fine now.
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I have just finished browsing the DLL section on Code Project and I didn't see an answer to the following question.
I am using DLL's as plugins in my application. The DLL's won't have a dialog or anything else viewable. The problems is that I want the dll's to be able to do work without being called.
For example if you have a function in a dll to compute the sum of two numbers. It only computes the sum of these two numbers when you call it.
What if the dll needed to continually be doing some work. One solution I can think of would be to have each dll have a Tick() funcion and call it repeatedly however many times a second you would like it to do its work.
Is there a way to have the dll be a self standing program and do its work when it needs to?
Hope that makes since.
|
|
|
|
|
Hi friend
The DLL is a short for Dynamic Link Library, and because it has the "Linking" behaviour, it must be linked to a program (Executable) or another DLL before it can function --> it can't be standalone.
if you want to run a DLL as a separate process, try using rundll32.exe program.
if the dll needed to continually be doing some work then you can create an internal thread and check for work status.
Regards,
Mohammad Gdeisat
|
|
|
|
|
I don't want it to be standalone. It would be linked at runtime.
Mohammad A Gdeisat wrote:
if the dll needed to continually be doing some work then you can create an internal thread and check for work status.
What do you mean? The dll should create an internal thread?
Here is what I am trying to accomplish.
I have a program this is a front-end for HTPC. I am trying to add all functionality thru
plugin dll's.
So the simple case senario you press a button on the frontend to load a weather module.
The weather module would download weather data, parse it and update this process every 15 minutes.
These dll's need the ability to have the ability to do work without being called expicitly.
|
|
|
|
|
Try CreateThread(...) inside the DLL. (And be prepared for some serious debugging problems.)
A better way would be "idle time processing" - to call a function in the DLL's when the message queue is empty.
|
|
|
|
|
Thanks, I will look into that.
|
|
|
|
|
hi, i have written an activex control in vc++ and now i want to add scroll bars to it as its graphics area is too big and may not fit into users VB Forms. so how can i do this ? thanx
|
|
|
|
|
Hello
Ime writing a program which involves recording from a web cam, but the only tutorials and examples that i can find are much to complicated!!
Does anyone have, or know where to find, a small (simple) program that can record video from a web cam. Preferably just using the windows console so that the program is easier to understand.
Thanks for your help,
Neil
|
|
|
|