|
>> i use microsoft common dialog control.
>> i open browser
>> and choice file(eg:C:/mydatabase/mydb.mdb)
>> save this file path "C:/mydatabase/mydb.mdb"
in my.dat(data file).
my problems
>> my.dat file is create C:/mydatabase/
>> i want to create this data file in my project folder.
(eg:C:/myvc++project/mytestvc++)
>> how to create my data file in my project folder
>> please explain me
>> my code is following
//mydlg.h
CCommonDialog1 m_com;
//mydlg.cpp
void CMYDLG::OnLoad()
{
CString file;
file.Empty();
m_com.ShowOpen();
file=m_com.GetFileName();
file.TrimRight();
if(file.Right(3)!="mdb")
{
AfxMessageBox("Please Select a .mdb file");
}
else
{
datafile.m_dataArray.Add(file);
datafile.Save_file_path();
//save database file path name eg:C:/mydatabase/mydb.mdb
}
}
|
|
|
|
|
#define DATA_FILE_MY _T("C:/myvc++project/mytestvc++/my.dat")
>>>>i change this way
>>>>now, okkk..
>>>>but, always this is not okkk.
>>>>i think
|
|
|
|
|
I can't really think of a better forum for this, so here we go...
Using VS NET IDE, Setup Project, does anyone know of a way to either modify the installation folder dialog or create a new one, so that the user can choose 2 install directories?
For example, 1 will be c:\program files\my company\my app
and 2 will be c:\program files\my company\common files
or something like that. Any ideas?
Rock!
Marcus Spitzmiller
"Why must life be so hard? Why must I fail at every attempt at masonry?" - Homer
|
|
|
|
|
Hello !
When i add Microsoft FlexGrid control, version 6.0 to my dialog, it open a message box with a error text line below :
The ActiveX control cannotbe instantiated.
And:
The ActiveX control "Microsoft FlexGrid control, version 6.0" could not be instantiated because i requires a design time lincese.
What can i do ?
Please help me.
Thank you.
|
|
|
|
|
http://support.microsoft.com/default.aspx?scid=kb;en-us;884878
MSND search is very helpfull thing.
|
|
|
|
|
I used Visual C++ 6.0
What is this problem ?
Thank you.
|
|
|
|
|
I am writing a function that print a bitmap to printer, but the image printed on paper was so tiny that I can hardly see it. I knew the reason (resolution problem).
How can I enlarge the bitmap object to match the printer resolution.
Thanks
|
|
|
|
|
I think StretchBlt api will help
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
I have a simple MFC custom control which extends CWnd.
It has a CButton member
I want to create the Custom control at run time in my main dialog (i.e. Without using Resource editor)
Could somebody outline the steps to do this? Thx
|
|
|
|
|
One way is to place a text control (static) on your dialog. Give it a proper ID number,
and call
m_MyControl.SubclassWindow (this, IDC_XXXXX)<code>.<br />
<br />
Another possibility is...<br />
<br />
<pre>
class CMyDialog : public CDialog
{
....
CMyControl m_MyControl;
....
};
BOOL CMyDialog::OnInitDialog ()
{
....
CWnd *pReplace = GetDlgItem (IDC_XXXX);
CRect rcReplace;
pReplace->GetWindowRect (&rcReplace);
ScreenToClient (&rcReplace);
m_MyControl.Create ( this, &rcReplace, WS_VISIBLE | WS_ETC, IDC_XXXX);
m_MyControl.SetWindowPos (pReplace, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
pReplace->DestroyWindow ();
....
}
</pre><br />
<br />
You might want a bit of error checking in there too! (ie. what if you forgot to make a IDC_XXXX control),<br />
I normally use IDC_PLACEHOLDER, but the constant name is up to you.<br />
<br />
Good luck,<br />
<br />
Iain.
|
|
|
|
|
How to get the file system? I wanna know if the file specified is in a hard disk with NTFS format.
|
|
|
|
|
Answer this by muself......I've just discovered the solution......
Use the Platform SDK function:
BOOL GetVolumeInformation(<br />
LPCTSTR lpRootPathName,<br />
LPTSTR lpVolumeNameBuffer,<br />
DWORD nVolumeNameSize,<br />
LPDWORD lpVolumeSerialNumber,<br />
LPDWORD lpMaximumComponentLength,<br />
LPDWORD lpFileSystemFlags,<br />
LPTSTR lpFileSystemNameBuffer,<br />
DWORD nFileSystemNameSize<br />
);
And check the resulting string lpFileSystemNameBuffer .
|
|
|
|
|
Hello,
I'm quiet new in C++ world and I have a problem where I'm really stucked.
My goal is to read in an Access Data Base in a specific table (Data base already exist and can not be change)
here is my code:
...
// Allocate the recordset
CRecordset recset( &database );
// Build the SQL statement
SqlString = "SELECT Name "
"FROM Target";
// Execute the query
recset.Open(CRecordset::forwardOnly,SqlString,CRecordset::readOnly);
The problem is that the name of my table is "I/O device" but it seems that the FROM Statement is not expecting any space.
How can I do?
Chan
The crazy guy
|
|
|
|
|
You should get a data source object by creating ODBC data source in Windows control panel and then use CDatabase::Open function to open it.
That is to say the name of your 'table' is not specified in your program but in Windows control panel, Your MFC ODBC Program can only open the data source you have created.
And then you can coutinue with your CRecordset recset( &database );
|
|
|
|
|
Hello lisoft ! Thank for your help.
here is my full code:
CDatabase database;
CString SqlString;
CString sSymbolName;
CString sDriver = "MICROSOFT ACCESS DRIVER (*.mdb)";
CString sDsn;
CString sFile = m_mdbPath;
int iRec = 0;
// Build ODBC connection string
sDsn.Format("ODBC;DRIVER={%s};DSN='';DBQ=%s",sDriver,sFile);
TRY
{
database.Open(NULL,false,false,sDsn);
CRecordset recset( &database );
// Build the SQL statement
SqlString = "SELECT Name "
"FROM I/O device";
recset.Open(CRecordset::forwardOnly,SqlString,CRecordset::readOnly);
This code is totally working while accessing a table that have a name without space (for exeample "Symbols" but as soon as I used a table named "I/O device" then I got an error.
Do you have any idea?
Chan
The crazy guy
|
|
|
|
|
You can try to use a square brackets surround your table name just like:
"SELECT Name FROM [I/O device]"
Wish it will help you.
Lisoft
|
|
|
|
|
THANK YOU Lisoft
!
It works fine...I tried everything except these stu... []..
Thank you now my reading is perfect.
Chan
The crazy guy
|
|
|
|
|
Hey guys,
I don't know how to handle the events in Visual C++ . NET There seem to be no Class Wizard as it used to be in VS6
My problem is I need to handle certain events from certain classes. Primarily I need to execute a portion of code (function) when the CSocket class (or CAsynSocket class) detects an event OnConnect(), notifying my MFC application about a client trying to connect to this server. The class CAsynSocket has this function (onConnect), I just don't know how to use it.
Even something simpler like executing a function when the key is pressed or the mouse is moved. Even that would help. Any event handling sugesstions would be greatelly appreciated.
Thanks.
Best regards,
Andrew
|
|
|
|
|
Hi Andrew,
I do this by using the Properties Window (under the View menu). Choose the .h or .cpp file of a class then open the Properties Window, there are 3 buttons which allow you to see Events, Messages and Overrides for that class.
Hope that helps,
Rob
|
|
|
|
|
Thanks a lot. It helped me to get started. Now I can handle any messages of the classes that are included in my project. Now I need to find out how to handle a message that is not included in my project (just some class from the library) in my case it is CSockets. I should be able to get it. Thanks again.
Best regards,
Andrew
|
|
|
|
|
How can I make certain data items in my CComboBox control appear/react as if they were inactive (not selectable, but visibly "ghosted"?)
Thanks,
Johnny
|
|
|
|
|
With a standard ComboBox, you can't.
But if you look in the combo box section of this site, there are several articles
about implementing special behaviour. The control I use is called (imaginatively)
CDisabledItemComboBox<code>, written by Petr Novotny.<br />
<br />
Iain.
|
|
|
|
|
Hi,
I have a problem to use fmode function in visual C++
If i use :
fmode(-2,10)
i obtain 0.
But in using Microsoft Excel MODE function like this :
MODE(-2;10)
i obtain 8
Where is the problem.
Thanks in advance
|
|
|
|
|
Dear all,
I have a dialog and some common controls (buttons, statics...) on that. To resize my controls when my dialog is being resized, I used MoveWindow and SetWindowPos functions. However, this caused lots of annoying flicker. How do I prevent this problem?
Thanks.
|
|
|
|
|
Control Panel->Display->Effects->Show window contents while dragging. Uncheck this checkbox.
"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!
|
|
|
|