|
Hello.
Please, help me, how to set focus into EditControl when I run the application?
I know how to do it in Delphi, does anyone know how to make this in Visual Studio C++ ?
Thanks.
|
|
|
|
|
use SetFocus (a member of CWnd)
MyEdit->SetFocus();
|
|
|
|
|
Hello, everyone,
In my current project, I want to display xp style button(OK, Cancel and apply) in the properties sheet.
If I do it using MFC, it would be very easy. I just need to
m_btnXPButton.SubclassWindow(GetDlgItem(ID_APPLY_NOW)->m_hWand);
But when I tried to do the same thing in ATL, the returned handle for ID_APPLY_NOW (IDOK and IDCANCEL) is NULL.
How can I get the handle of a control in the properties sheet written in ATL.
Thanks a lot in advance.
bin
|
|
|
|
|
bin8922 wrote:
How can I get the handle of a control in the properties sheet written in ATL.
Don't forget about this forum.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Does GetdlgItem(...) does not work?
MSN Messenger.
prakashnadar@msn.com
Tip of the day of visual C++ IDE.
"We use it before you do! Visual C++ was developed using Visual C++"
|
|
|
|
|
I tried to use GetDlgItem(IDOK), but the returned value is NULL
|
|
|
|
|
How do you remove a gripper from a status bar. I created it using:
m_wndStatusBar.Create(this, CBRS_BOTTOM|WS_CHILD|WS_VISIBLE|CBRS_SIZE_FIXED);
I have tried the following to remove the gripper:
m_wndStatusBar.ModifyStyle(SBARS_SIZEGRIP,0);
but it didn't work.
Does anyone know how to remove the gripper.
Thanks
|
|
|
|
|
Hello all...I have a dialog based application. What i want to do is, set up a timer in my dialog, say for every 4 minutes, i want my dialog to call a function from another dialog to write some data into a file. How can i accomplish this. I have looked at and tried timers in a regular mfc program, but have not had success with a dialog based program. If anyone has a sample code or an article pertaining to timers and dialogs, i would appricate the help.
none
|
|
|
|
|
modeonetwo wrote:
...say for every 4 minutes
Which is equal to 240,000 milliseconds.
modeonetwo wrote:
...but have not had success with a dialog based program
Meaning what? To simply state that something did not work is not very informative. I assume that you did not have compiler/linker errors, but had run-time errors instead.
A timer does not care that it was created in the context of a window or a dialog (which is just a specialized window). Once you create it and the specified time has elapsed, the specific callback function is called or a WM_TIMER message is posted to the owning application.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
In OnInitDialog() call SetTimer with appropriate parameters. Then (in the dialog class) write a handler for WM_TIMER . You can do it through classwizard, analogous to other messages, because CDialog is derived from CWnd .
Robert-Antonio
"A flower walked around a meadow. She saw a beatiful human and plucked off his head."
|
|
|
|
|
Hi,
I have an SDI that spins off a thread. How can I get access to the window (GetMainWnd) and also pass variables from my CWinApp derived class to the thread ?
Thanks !!
|
|
|
|
|
pMyApp = (CMyWinApp*)AfxGetApp();
and there is also
pMyWnd = (CMyWnd*)AfxGetMainWnd();
Or just keep it global or "delivere" it into as function parameter.
|
|
|
|
|
I have a dll that I created in C++ and declare the function in a VB .exe and it works just fine. But when I give the folder to somebody else and have them run the .exe with the dll in the same folder I get a 'run-time error 53: Export.DLL not found'. Even if I hard code it and specify it with an absolute path I still get the same error. This dll doesn't have to be registered. Does anyone know what's going on?
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Is your dll using any other dlls?
Maybe they can not be loaded but final efect
is that head dll error is reported.
For example if you build dll in
Debug and you are distributing it
on computer without same developer tool.
(there are only release version)
It will not to work.
that sometime happen
|
|
|
|
|
I made the DLL with MFC statically linked, so it shouldn't be that. what about #include files? For instance, I'm using the MySQL.h header file and linking to its .lib file when compiling my DLL, but they are not included in the project. Should I do that? thanks for your help
If it's broken, I probably did it
bdiamond
|
|
|
|
|
some years ago i’ve coded dlls for VB 6.0 and had the same trouble,I don’t know why an VB app needs full path to dll even if dll is in its folder. you can use some APIs like GetModuleFileName to get full path to your application then append dll name to it. I don’t know if there is some better way to solve it I’m not VB coder.
|
|
|
|
|
I want to know how I the meaning of those syntax elements of C++:
key word:
virtual,
protected,private,public
inline
friend
#pragma directive
namespace
For most of the time,I think I can somewhat get freshed innovative ideas,but that is quite different from programming.
I find that many computer concepts or design patterns are derived from the human's understanding from the real world,in other words,I think that many professional phrases of computer science,which is the in my point of view is the biggest obstacle that hamper me mastering that skill.
So I really hope that sophisticated members of this website may help me clearing those unfamil
|
|
|
|
|
Have you consulted MSDN for the definition of these terms?
From the author of C++, this page might also help.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I am banging my head against the wall on this one... I'm not a Visual C++ expert, I am used to coding on the Mac, but I assume that this is a simple thing to do... but I cannot for the life of me find any info on it.
I used the AppWizard to create a dialog-based application, and it has the toolbar, menu, etc. When the user chooses to save it, the save dialog box comes up with the default file filter "All files (*.*)". I want to make it so that this list contains only the file types that the user can save. How do I do this? I have the serialization code in, everything works fine, I just want to force the filename to have the correct extension.
|
|
|
|
|
Let say your extension is "txt"
Second parametr of CFileDialog constructor is the
default filename extension.
Call can looks like this:
CFileDialog mySaveDlg(FALSE, "txt");
mySaveDlg.DoModal();
strPath = mySaveDlg.GetPathName();
or better (to show the extension)
CFileDialog mySaveDlg(FALSE, "txt", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Text file|*.txt||");
mySaveDlg.DoModal();
strPath = mySaveDlg.GetPathName();
|
|
|
|
|
I'm not sure how you get this in an MFC Dialog Based app but the MFC default File Open/Save(As) dialogs use the IDR_MAINFRAME string in the resource file.
For example and app named 'cp2' with a file extension of 'myt',
cp2\n\ncp2\ncp2 Files (*.myt)\n.myt\ncp2.Document\ncp2.Document
This string is associated with a document template in your apps InitInstance function and the contents and format are documented with CDocTemplate::GetDocString (), you can obviously have different document types with different strings leading to different extensions.
Alternatively you could bring up the open/save dialogs yourself using CFileDialog, then you can do what you like right at the point of relevance.
Paul
|
|
|
|
|
Any ideas on how to call a text file from Menu, its seems pretty simple the file won't open up???
Kind Regards
Kevin
|
|
|
|
|
Try using ShellExecute() with the name of the text file as the third parameter.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
The Subjets says it all
I want the same behavior as any image or word processing application actually.
For instance:
- open a image.bmp file
- launch Save as... command.
- change the type to 'Portable Network Graphics (PNG)'
I want my File dialog change the selected name to image.png.
I've scanned MSDN with the OnChangeType() stuff but when I tried to change CommDlg_OpenSave_SetControlText(hDlg, edt1/cmb13, "file.newextension");
it has no effect...
I'm a bit puzzled. Any idea?
-MyttO
|
|
|
|
|
I have created a DLL in which I'm running a query on a MySql database, then exporting it row by row into a .dbf file. Everything works except that it is very slow when it comes to a few thousand records at a time. I'm trying to speed it up in one area by changing my algorithm for output of the dates. in a particular field of the MySQL database there is a timestamp saved which returns this:
"20040325122530"
I need it to end up like this:
"2004-03-25 12:25:30"
I'm doing that now with CString Insert() function but for a 25-field query of 10000 records it's taking about 8 minutes!! Or are CStrings generally too slow anyway and would it be faster to just use char*?
bdiamond
|
|
|
|