|
glitteringsound wrote: I dont know for exporting functions from exe what convention is used?
You can always do something like this:
<br />
#define EXEEXPORT __declspec(dllexport)<br />
<br />
void EXEEXPORT MyExportFunction() {<br />
<br />
}<br />
<br />
|
|
|
|
|
i would like to create a toolbar which is docked to the left side of the SDI window but which has two column instead of one which is the default. What i already know is:
1. Derive a class from toolbar
2. Include a handler for WM_SIZEPARENT, which is MFC's private message.
3. Overwrite the virtual functions CalcDyanamicLayout and CalcFixedLayout in my derived class.
4. Write code in CalcDynamicLayout and CalcFixedlayout to set the flags of each button in the toolbar.
5. Use my derived Toolbar to replece the original toolbar.
I need help in 3 and 4 especially 4. I am also getting some kind of error when i close my application. Anyone who can help me out would be great. If you have better idea, please advise so.
Mark
|
|
|
|
|
You shouldn't need step 2.
I personally use a CControlBar with CToolbars embedded (members of the
control bar).
Here's 3 reasons why...
In the CControlBar class Calc____Layout() override(s) I can return a CSize
that has the appropriate dimensions to fill a side of the parent frame window.
In the CControlBar class Calc____Layout() override(s) I can resize the embedded
toolbar(s) to force it to wrap the rows/columns of buttons into multiple rows or
columns (depending on orientation).
With CControlBa, it's easy to mix toolbars and any other windows/controls and wrap them
all nicely in one bar docked to the frame.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I got your idea. But i am not sure if i can not do it the way i am doing it. That is derive my class directly from CToolBar. I think you are saying that derive my class from CControlBar, which has CMyToolBar class embedded in it which is more flexible.
I would need CControlBar the way you described it as an option bar in my application which will be horizonal. My vertical bar needs not to be moved and will be fixed. Depening on which button you press in ver bar, the right option bar should show. It is more like adobe photoshop type application that i am trying to develop.
You said i do not need step 2. That is using WM_SIZEPARENT. Is that what you really meant. Please explain a little. And thanks for the help.
Mark
|
|
|
|
|
Hi all, im trying to make an application that requires me to use the API WinMain() and it just so happens i need to use argv and argc. Problem is that WinMain takes 4 arguments in it and doesnt have room for argc/argv[]. So i looked up the issue and as it turns out MS didnt allow the usage for whatever reason (which really isnt important to me because i need to make it work.) So i figured if i cant put it in the calling function then make it apart of a if statement. So this is what i did.
<br />
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd){<br />
string file2="C:\\Debug\\test.exe";<br />
<br />
if(__argv[0] == file2){<br />
ofstream file;<br />
file.open("test.txt");<br />
file << "Sponcer brought to you by - Subway! Eat Fresh! :) " << endl;<br />
file.close();<br />
system(buffer);<br />
exit(1);<br />
}<br />
else{<br />
Sleep(1000);<br />
exit(1);<br />
}<br />
return 0;<br />
}<br />
And it works. But my problem is that i dont want to have to specify the name of the program and file path etc etc. Thats what argv[0] is for. So what im trying to do is this....
Use argv within the WinMain function so that i can print out file/path info. That way i can work my way around other problems. Thanx in advance!
|
|
|
|
|
I don't quite understand your question, but have you taken a look at WinMain() 's third parameter, lpCmdLine ?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Im trying to get the current file name from argv using WinMain(). But since i cant put argv[] or argc in the function arguments, i have to use another method. Thats what im saying
|
|
|
|
|
dellthinker wrote: Im trying to get the current file name from...WinMain().
So how about GetModuleFileName() ?
dellthinker wrote: But since i cant put argv[] or argc in the function arguments, i have to use another method.
And that way is fine. There's nothing wrong with using __argv[0] .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You need to use GetCommandLine and CommandLineToArgvW like
#include <windows.h><br />
#include <stdio.h><br />
#include <shellapi.h><br />
<br />
int __cdecl main()<br />
{<br />
LPWSTR *szArglist;<br />
int nArgs;<br />
int i;<br />
<br />
szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);<br />
if( NULL == szArglist )<br />
{<br />
wprintf(L"CommandLineToArgvW failed\n");<br />
return 0;<br />
}<br />
else for( i=0; i<nArgs; i++) printf("%d: %ws\n", i, szArglist[i]);<br />
<br />
<br />
LocalFree(szArglist);<br />
<br />
return(1);<br />
}
|
|
|
|
|
in the C++,there are some ashen character,what is that mean especially?
|
|
|
|
|
youbo wrote: ashen
i've never seen that word used in a programming context.
|
|
|
|
|
youbo wrote: ...ashen character...
Covered in ash?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
in the C++,the key is blue,the generic character is black,but there are some characters is ashen,like endif at somewhere.don't you have seen?
|
|
|
|
|
I don't have my IDE configured in such a fashion.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Are you using Visual Studio?
Russell
|
|
|
|
|
I am using the RegQueryValueEx() Function to fethch the value from the reggistry I set previously.
But getting porblem. It fetches only first charcter only.It Show the Corrent size of the Value but Fail to Fetch the Whole String.Previously I was using the RegQueryValue() and It is working Fine . But I need to use RegQueryValueEx() as I have to fetch Other valued in addition with default.
The Code I am using is as follow.
RegOpenKey(HKEY_CURRENT_USER,L"Software\\PersonalMenu",&hKey);<br />
Code= RegQueryValueEx(hKey,L"JAVA",0,&Type,NULL,&size);<br />
BYTE *Data = new BYTE[size];<br />
Code= RegQueryValueEx(hKey,L"JAVA",0,&Type,(BYTE *)Data,&size); <br />
I dont know what is the problem with it. If it is showing the Correct size of the Value don't it also show the Value.
|
|
|
|
|
Do you have a unicode project setting but not viewing the string as unicode ? This would explain that you would see the first character.
|
|
|
|
|
Are you getting a string value into a BYTE array?
If so, how are you examining the string? Intellisense may only show you the first byte.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I am using using STL::map in one of my .cxx files. .cxx is a schema file generated by VC++ using \Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT.
But whn I build the code I get these Link Errors
schema.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall Linking...
Creating library Release/Schema.lib and object Release/Schema.exp
LINK : warning LNK4098: defaultlib "mfc42ud.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "mfcs42ud.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "msvcrtd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
schema.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall _STL::_Lockit::~_Lockit(void)" (__imp_??1_Lockit@_STL@@QAE@XZ)
schema.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall _STL::_Lockit::_Lockit(void)" (__imp_??0_Lockit@_STL@@QAE@XZ)
Release/Schema.dll : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
My concern is these 2 Link errors!!!
can u help me out?
thanks,
Vinod.C.S
|
|
|
|
|
Vinod CS wrote: "mfc42ud.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "mfcs42ud.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "msvcrtd.lib"
those are the debug versions of the C/MFC runtimes, but you're apparently doing a release build. you can't mix debug and release builds like that.
if you're linking to a static library, make sure you're linking to the release build of the library for release builds of your EXE
|
|
|
|
|
I am Using Win32 Dialog based Application. And trying to add the string in Combo Box as runtime with following code.
HWND hComboBox = GetDlgItem(hWndDlg,IDC_NameCombo);<br />
LRESULT lr = SendMessage (hComboBox,CB_ADDSTRING, 0, (LPARAM)L"Item 1 ") ;<br />
But nothing is added in ComboBox. I checked the lr Value and it show 0. I.e. Operation Completed Successfully.
if you know please tell me what is the problem.
Thnx in Advance.
|
|
|
|
|
Your code is working perfect without any problem but did you check return value of hComboBox and whats value of lr?
|
|
|
|
|
It not working Here. I have Win32 Dialog Based Application
Earlier I was using the Code when Some press the Butoon. Now I have put it in
WM_INITDIALOG But it is still not working
The Value of Combo Box Handle (hComboBox ) is 0x002804c2
And the Value of LRESULT from SendMessage() is 0.
|
|
|
|
|
I dont know what was the problem. But i deleted the Combo box And Add new One. And Now Its working Fine.
|
|
|
|
|
If its working so you dont need to help .
|
|
|
|