|
hm... It is about 4 years ago, that I did it...
I had the same ressource IDs in the main App AND in the DLL,
but in different languages.
I guess, you can do it like this:
HINSTANCE hDLL = AfxLoadLibrary("ress.dll");
HINSTANCE hRes = AfxGetRessourceHandle();
AfxSetRessourceHandle(hDLL);
//now do your dialog stuff..
AfxSetRessourceHandle(hRes);
AfxFreeLibrary(hDLL);
|
|
|
|
|
Cheickna wrote:
// HERE I WANT TO DISPLAY MY DIALOG
CYourDialogClass dlg;
dlg.InitModalIndirect(lpDialogTemplate);
dlg.DoModal(); Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
hi there
sorry for this question and dont kill me thanks
(at the moment i work on pocket pc - so there are missing some desktop mfc stuff - but i think its a generally c++ question)
i want to read a file line by line. is it a "good" way to read only once char at time and check for a \n? or is there are more "professional" way to do it?
e.g. this dummy code:
CFile file;
file.Open( L"\\file.txt", CFile::modeRead );
BYTE w[1];
CString s;
while( file.Read( &w, 1 ) != 0 )
{
if( w[ 0 ] == '\n' )
{
MessageBox( NULL, s, NULL, NULL );
s = "";
}
else
{
s.Insert( s.GetLength(), w[0] );
}
}
file.Close();
|
|
|
|
|
<br />
try<br />
{<br />
CStdioFile File("MyFile.txt",CFile::modeRead|CFile::typeText);<br />
<br />
CString strBuf;<br />
bool bNotEOF;<br />
<br />
bNotEOF = File.ReadString(strBuf);
<br />
while ( bNotEOF ) <br />
{<br />
bNotEOF = File.ReadString(strBuf);
}<br />
File.Close();
}<br />
catch(...)<br />
{<br />
::AfxMessageBox("some error");<br />
}<br />
<br />
hope this helps
|
|
|
|
|
i found a nearly similar code too ... but there is one problem:
error C2039: 'ReadString' : is not a member of 'CStdioFile'
on pocket pc the readstring method isnt available
also "getline" + some iostream functions are not available
|
|
|
|
|
If you look at the implementation of GetLine() of a similar function, you'll notice that it reads from the file character by character until EOF or '\n' is encountered! So what you can do is write your own getline .
Tip, one of the parameteres should be the length of the buffer you are putting the characters in, this helps avoiding problems.
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
|
You could also try using fscanf, which includes a format parameter, and you can specify that the scan reads up to but not including a set of characters. (From memory, check the docs) ...
fscanf (fileptr, "%^['\n']s, &buf);
The format specifier is essentially %s, but in between the % and the s is the "up to but not including this list of chars ... the newline."
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
Hi
I've write some strings into the registry by using 'WriteProfileString()'.
Like this (in the registry):
MYPROGRAM
|
|-- EMPLOYEE
|
|
Name: Jens
Salary: 3Million Euro
Birthdate: .....
etc
Now i want to delete the entire section ("employee"). How can i achieve this?
Greetings
Jens
|
|
|
|
|
Search MSDN for RegDeleteKey
MS
|
|
|
|
|
I have recently had to work with the registry too, and I found that CodeProject has an entire section of articles about the registry. Using the list on the left, follow links through General/System/Registry.
I found that one of the easiest to do "simple" things was from Joseph Newcomer (http://www.codeproject.com/system/registry_class.asp[^]).
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
Use CWinApp::DelRegTree. It will delete the key and all subkeys. Stay away from the roll-your-own registry solutions. CWinApp's have methods Get/Write for profile data and it can either be the registry or an .INI file.
|
|
|
|
|
Hi!
I am creating an application which connects to a ftp server and put a file on the server. When I press the send button it sends the file without problem but it seems to me like my application is freezed until the send operation is done! When I click on something on my program before the send operation is terminated my program just crashes down! This is the code I use:
--------------------
CInternetSession InternetSession;
CFtpConnection *m_pFtpConnection;
try
{
m_pFtpConnection = InternetSession.GetFtpConnection(m_serv, m_user, m_pass, INTERNET_INVALID_PORT_NUMBER, m_passsive);
}
catch ( CInternetException *pEx )
{
TCHAR szError [1024];
if ( pEx -> GetErrorMessage ( szError, 1024 ) )
AfxMessageBox ( szError );
else
AfxMessageBox ( "There was an exception." );
pEx -> Delete ();
m_pFtpConnection = NULL;
}
m_pFtpConnection->PutFile("...............", "............." );
if ( m_pFtpConnection != NULL )
{
m_pFtpConnection->Close ();
delete m_pFtpConnection;
}
---------------------------------------
How can I fix this?
Thank you for your future answers!
Well... I am a beginner ...
|
|
|
|
|
Scolinks wrote:
...my application is freezed until the send operation is done!
This is normal behavior. If you want your application to do other things while the file is being transaferred, but this code in a separate thread. Or you could use CFtpConnection::OpenFile() and CInternetFile::Write() to write the file in chunks, updating your UI in between.
|
|
|
|
|
Does anyone know how to implement the OnAfterPrint event in HTML? I'm using CHtmlView but can't see how to slot this in. Any help appreciated!
|
|
|
|
|
I'm working with ODBC and using *.mdb tables.
I wanna show one of tables on a dialog.
How can I do this?
emroz
|
|
|
|
|
What you mean "show the table"
I assume you wanna show the data of the table?
You need EditBox, StaticBox, (may be ComboBox) for the data to be shown on the dialog box.
|
|
|
|
|
I wanna see all of records.
I used dataGrid in visual basic.
You can see the table on the form with it.
How can can I do it in visual C++
emroz
|
|
|
|
|
Hi,
You can use ListCtrl to do this. But you must write an sql query and insert data yourself. Property 'Datasource' don't exists in listrcl
cheickna
|
|
|
|
|
The simple way to incorporate ADO into your application is through the use of ActiveX controls. You can add the ADO data control to your Visual C++ project, just like any other ActiveX control. Once you add the ADO control to your project, and place it on a window, you’ll need to
specify the data connection in the control properties. You’ll also need to specify the source for the records that will be retrieved by the control.
To use the ADO control efficiently, you’ll also want to use data-bound controls that are ADO-enabled, such as the Microsoft DataGrid control. When you add these controls to
the window with the ADO control, you’ll specify the ADO control as the data source for the control. If the control is designed to only provide access to a single field in a record set, you’ll also need to specify which field is to be used for the control. Once you add all these controls to the window and configure them, you can run your
application and have full database access through ADO without having written a single line of code.
If you cannot follow all the steps then you should try to read something about ActiveX controls (how to add them to your application).
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
How to highlighted the cell's frame when I have 'copy' the cell,like Excel?
|
|
|
|
|
Hi,
I created one dialog based application.
When i draw listbox on dialog box and then any activeX
partially overlapping the listbox.
As at build time AcitiveX control is behind the Listbox
control. But after running, AcitiveX comes to the front.
I need to have ActiveX behind the listbox at runtime also.
Or AcitveX contorl' position should be consistence in both
run and build mode.
I need to solve it very
urgently, Please suggest some ideas.
Harinath Reddy
Bangalore,
India-560076
|
|
|
|
|
Bring your listbox to top using BringWindowToTop member function in your OnInitDialog. So, your listbox will always be on your ActiveX.
Hope this helps
|
|
|
|
|
Thanks for the suggestion.
But My problem is not only with a particular control or a specific order.
I will tell the problem again..
If u create Just a MFC AppWizard "dialog based" application.
Now if u draw any controls like: Listbox, edit control,combobox but not button and then ActiveX control overlapping with above control.
Runtime appearence of ActiveX will be different ie activeX will come to the front.
This behavior is just with MFC code.
I want the consistence behabior of ActiveX with Other controls.
I expect some idea from u.
Once again thanks
-Harinath
Harinath Reddy
HOneywell Technology Solutions Lab,
Bangalore,
India-560076
|
|
|
|
|
This problem I had asked previously . I used the solution given as follows.
m_imageList.Create(16, 16, 0, 1, 1);
hIcon = AfxGetApp()->LoadIcon(IDI_ADDUSER);
m_imageList.Add(hIcon);
pList->SetImageList(&m_imageList, LVSIL_SMALL);
pList->InsertColumn(0, "Users", LVCFMT_LEFT, 150);
But still image is not getting set . Icon used is of size 16 * 16
|
|
|
|