|
Just started to try and use the CToolbar class on my MFC Dialog application.
Finding it a bit strange to use and dont know where to put the events (e.g. open file etc).
Does anyone have/know where a good example is as all I have found are MDI and SDI examples.
Note I have got he Toolbar on display, but would like to position it and attached events.
Regards,
|
|
|
|
|
I wang to get all font supported by system with API EnumFonts,but i don't know how to use it ,and i dont know what i should do in callback.if u know how to do,give me some code,thanks.
Happy Gemini
|
|
|
|
|
Have you consulted MSDN?
int CALLBACK EnumFontFunc( CONST LPLOGFONT, CONST LPTEXTMETRIC, DWORD, LPARAM )
{
return 1;
}
int nReturn = EnumFonts(hDC, lpszFaceName , EnumFontFunc, 0);
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
What is the difference between
char *ptr="babu"
char ptr[]="babu"
babu
|
|
|
|
|
Nothing...
The 2nd declaration is more readable through the program, as it is clear that you are using an array.
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
There is a difference, check the disassembly
127: char aaa[] = "ssss";
004B423D mov eax,[string "ssss" (005fd498)]
004B4242 mov dword ptr [ebp-18h],eax
004B4245 mov cl,byte ptr [string "ssss"+4 (005fd49c)]
004B424B mov byte ptr [ebp-14h],cl
128: char *bbb = "bbb";
004B424E mov dword ptr [ebp-1Ch],offset string "bbb" (005fd46c)
129:
130: char *cc;
131:
132: cc = bbb;
004B4255 mov edx,dword ptr [ebp-1Ch] ; address of string is loaded from memory
004B4258 mov dword ptr [ebp-20h],edx
133: cc = aaa;
004B425B lea eax,[ebp-18h] ; cc just gets address
004B425E mov dword ptr [ebp-20h],eax
rrrado
|
|
|
|
|
char *ptr -> ptr is pointer to memory, where the string is stored, you can set it later to point to another string.
char ptr[] -> array, you can only change string content ... i think shis will consume 4 bytes less memory than first definition
rrrado
|
|
|
|
|
hi,
i have an application wich load a dll:
typedef void (__cdecl DRDNDLL)(int);
void CProjectDoc::OnTest() {
CString str = "DrDnDll.dll";
HMODULE hmodule = ::LoadLibrary(str);
if(hmodule != NULL) {
DRDNDLL* dllFunc=(DRDNDLL*)GetProcAddress(hmodule,"Test");
if (dllFunc != NULL)
dllFunc (1);
else
AfxMessageBox("Error-GetProcAddress");
else {
CString dllstr = "Error-LoadLibrary: Can't find "+str;
AfxMessageBox(dllstr);
}
FreeLibrary(hmodule);
}
in the dll i have a dialog which is non-modal:
extern "C" __declspec(dllexport) __cdecl Test (int tst) {
Dlg_Test* dlg;
dlg->Create();
}
but the dialog calling crashed.
can anybody help me?
thanks frank
|
|
|
|
|
Which type of DLL u r using
If else try out with MFC Extension DLL
Also where is your dialog resource ? in dll or in exe
Move it to Dll and then try.
|
|
|
|
|
it is a mfc extension dll and the dialog is located in this dll.
|
|
|
|
|
Frank Conrad wrote:
it is a mfc extension dll and the dialog is located in this dll.
For dialogs in extension dlls, you either need to make sure your dialog IDs don't overlap with the executeable programs resource IDs (which keeps you from reusing your extension dll), or keep track of the dll instance handle, explicitely load your dialog from the dll, and use CreateIndirect to create your dialog. Have you done either?
Nathan Holt
|
|
|
|
|
You call FreeLibrary immediately after calling the dll function. If the modeless dialog is still shown you have just snatched away its comfort blanket!
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
in the dll i have a dialog which is non-modal:
extern "C" __declspec(dllexport) __cdecl Test (int tst) {
Dlg_Test* dlg;
dlg->Create();
}
but the dialog calling crashed.
the dialog pointer is not valid before ur calling create function on the pointer. That should be done hopefully the following way
Dlg_Test* dlg;
dlg = new Dlg_Test();
dlg->Create();
Hope the above works.... otherwise problem would be with the actaul dialog resource.
Gudluck
Adi
|
|
|
|
|
i want to know how to use vbcrlf function in vc++.
How to get New line message in vc++.
I want to new line in Editbox.
|
|
|
|
|
Hi,
Enable multiline and vertical scroll property in the normal edit controls properties window. To go to next line use CTRL+ENTER
Sujan
|
|
|
|
|
and to actually display text with a crlf, use "\r\n" within your string. For example:
in VB you would enter the following:
"FirstName" + vbcrlf + "LastName"
to get
FirstName
LastName
In C++:
"FirstName\r\nLastName"
for same results
[insert witty comment here]
bdiamond
|
|
|
|
|
hi all,
I want to Compile the Samples of the SDK "RTC Client APIv 1.2".I have tried several times according to the readme file..But it would not succeed YET.How do I do that?..So please any one know about Real time Communication(RTC) SDK and samples,please send me a reply.
Thanks in advance..
|
|
|
|
|
Hi,
I am developing a Audio Codec. To check the performance of my program i need to know the Machine Cycles consumed by each functions in my program.
Is there any tools/settings in MSVC++ to know the "Machine Cycle" of all functions in my program ?
Thanks in advance.
Regards,
-Victor.A
|
|
|
|
|
Well not sure I completely understand what you want but you might try using the QueryPerformanceCounter and QueryPerformanceFrequency API's.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
No, I am actually looking for some settings in the project or profiler kind of tool.
|
|
|
|
|
I use mouse wheel in my application to alter the size of a square in my view. I use ON_WM_MOUSEWHEEL() to catch the wheel messages.
Everythin worked just fine, untill I upgraded to XP. Now I get ON_WM_VSCROLL() messages instead, and never see the wheel messages when the scrollbar is on.
I want to find a way to bypass the scrolling and have wheel messages instead, how?
Thanks
Jesper
|
|
|
|
|
Hello, I have made a php script that uploads a file to your server, then I made this feature available from a c program by tricking the php into believing that the upload button has been pressed with the use of a text encoded with mime. I have apache installed on my comp with php php 4.4 and on my comp this works but on this server of a friend:
FreeBSD Apache/1.3.31 (Unix) mod_ssl/2.8.18 OpenSSL/0.9.7d FrontPage/5.0.2.2635 PHP/4.3.6 mod_throttle/3.1.2
note php 4.3.6
it doesn't anyone know why
I could provide source code if needed.
|
|
|
|
|
I created a simple application that contains a text field (member variable CString m_Data)and OK button
When user clicks OK button the file text.txt is read.
text.txt contains
LINE 0
LINE2
LINE3
LINE4
How can I skip the first line and display the second line in the text field ? (e.g LINE1)
Is there a better way?
Idealy what I want is to load second line then user clicks next and the third line is loaded and so on
I tried this but it does not skip first line
///////////////////////////
CFile cf;
if(cf.Open("text.txt",CFile::modeRead))
{
int nFileSize = cf.GetLength();
char * lpBuffer = new char [nFileSize+1];
cf.Read(lpBuffer,nFileSize);
m_Data = lpBuffer;
delete []lpBuffer;
}
else
{
MessageBox ("not loaded","Can not open file", MB_OK);
}
}
Any help will be greatly appreciated
|
|
|
|
|
Hi,
Check for netline(return) char and get the text and display it.
Sujan
|
|
|
|
|
Use the CStdioFile MFC class. It is derived from CFile and it handles individual text lines, automatically handling newline and return feeds.
I think it only has the ReadLine() and WriteLine() functions.
I Dream of Absolute Zero
|
|
|
|