|
Do you mean the separators, or the actual buttons themselves.
If you're using flat toolbars, separators look like etched vertical lines.
If you're not using flat toolbars, buttons look like... buttons, with two vertical lines and two horizontal ones.
If you're seeing a single vertical line, right down the center of the screen, you've got one of those annoying Trinitron monitors turned on its side...
--------
PMGRE --Shog9 --
|
|
|
|
|
yes, i mean separators and flat tool bar by CreateEx function, but i don't understand ur idea for deleting the vertical line (the separator button is still there and just no the vetical line)
more info please, thx
includeh10
|
|
|
|
|
So, what you want to do, is have a flat toolbar, with separators, but not showing the separators?
You can use the technique described in this article [^] to do so.
--------
PMGRE --Shog9 --
|
|
|
|
|
I am trying to learn how to create and use dll, but so far I haven't been able to even print a "hello" message on the screen. I am reading instructions at msdn library, but can't find what I need. I need instructions(basic) on how to create and load dll. Any simplest examples(say to print "hello" using dll)anyone could send me I would appreciate.
Is there any book about dll, or any website?
A project I created gives me 2 errors("could not get function 1 process address")when is executed; it is compiled without errors.
Here is my .def file:"
LIBRARY prcAttach
DESCRIPTION "Where the functions really live"
EXPORTS
function1 @1
function2 @2 "
I set "Not Using MFC" in Project/settings/general because that's what a friend of mine uses and his project works fine.
Here is my dllLoad.cpp file
#include <windows.h>
#include <iostream>
//typedef for a: int function1(int i);
typedef int (*F1)(int);
//typedef for a: char function2(char c);
typedef char (*F2)(char);
int main(int argc, char * argv[])
{
HMODULE hDll;
F1 func1;
F2 func2;
hDll=LoadLibrary("prcAttach.dll");
if(hDll==NULL)
std::cout << "Could not load dll" << std::endl;
else
{
MessageBox(NULL,"Library loaded","dllLoad",MB_OK);
func1=(F1)GetProcAddress(hDll,"function1");
if(func1==NULL)
std::cout << "Could not get function 1 proc address" << std::endl;
func2=(F2)GetProcAddress(hDll,"function2");
if(func2==NULL)
std::cout << "Could not get function 2 proc address" << std::endl;
MessageBox(NULL,"functions found","dllLoad",MB_OK);
MessageBox(NULL,"Hello","dllLoad",MB_OK);
func1(1);
func2('a');
FreeLibrary(hDll);
}
return 0;
}
Here is my prcAttach.cpp file(prc-short for process)
#include <windows.h>
void ShowMessage(char const * szcM)
{
MessageBoxEx(NULL,szcM,"HostDLL",MB_OK,LANG_ENGLISH);
}
extern "C"
{
int function1(int i) {ShowMessage("I changed hostdll function 1");return i;}
char function2(char c) {ShowMessage("hostdll function 2");return c;}
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID
lpvReserved)
{
switch(fdwReason)
{
case DLL_PROCESS_ATTACH:
// Initialize once for each new process.
// Return FALSE to fail DLL load.
DisableThreadLibraryCalls(hinstDLL); // Remove to allow multiple threads to attach
break;
/* uncomment this block to handle multiple thread attachments
case DLL_THREAD_ATTACH:
//Do thread-specific initialization
break;
case DLL_THREAD_DETACH
//Do thread-specific cleanup
break;
*/
case DLL_PROCESS_DETACH:
// Perform any necessary cleanup.
break;
}
return TRUE; // Successful DLL_PROCESS_ATTACH.
}
Could anyone help please!
thanks in advance
mel
|
|
|
|
|
The code looks fine to me. Have you by chance forgotten to insert the .DEF among the files in the DLL project (as you would with an ordinary .cpp file)?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I tried:
void CFormViewMDIView::OnChecking()
{
//GetDlgItem(ID_CHECKING)->SetWindowText("abc");
m_toggle = m_toggle==0? 1 ;
// if (m_toggle == 0)AfxMessageBox ("aaaa");
}
void CFormViewMDIView::OnUpdateChecking(CCmdUI* pCmdUI)
{
pCmdUI->SetText(m_toggle? "Search":"Start") ;
}
But the text doesnt change. What am I not doing right?
Thanks,
ns
|
|
|
|
|
|
I didnt mean to ask the same thing twice. Thanks for the reply. I posted my questions regarding that in response...
|
|
|
|
|
When I press on a menu item, I want its text that says "Search" to change to "Start". Is this a very trivial question?
I tried:
void CFormViewMDIView::OnChecking()
{
GetDlgItem(ID_CHECKING)->SetWindowText("abc");
}
where the ID of the menu item is ID_CHECKING, but it crashed. AM i on the right track? WHat am I doing wrong?
? thanks,
ns
|
|
|
|
|
|
I tried the MSDN sample code. It works. I couldnt implement
// Look for "Open" menu item from the File menu. Insert a new
// menu item called "Close" right after the "Open" menu item.
// ID_CLOSEFILE is the command id for the "Close" menu item.
pos = FindMenuItem(submenu, "&Open...\tCtrl+O");
if (pos > -1)
submenu->InsertMenu(pos + 1, MF_BYPOSITION, ID_CLOSEFILE, "&Close");
because if its a new menu item, then how do you specify ID_CLOSEFILE? I have only seen a way to name a menu iD through the propertiesd window, in which case the menu item is already on the menu. SO I am puzzled greatly.
The other question is:
I want to change the title of the toplevel menu, not a submenu. I tried:
CMenu* mmenu = GetMenu();
// Look for "File" menu.
int pos = FindMenuItem(mmenu, "&File");
if (pos == -1)
return;
UINT id = GetMenuItemID(pos);
ModifyMenu(id, MF_BYCOMMAND, id, "&Save Selection");
but errors in compile. Besides for a toplevel item, id = -1.
Hwo do I modify this to get the correct behavior?
Thanks,
ns
|
|
|
|
|
To change the titlew of the toplevel menu I tried:
CMenu* mmenu = GetMenu();
mmenu->ModifyMenu(ID_CHECKING, MF_BYCOMMAND, 0, " Selection");
Invalidate();
On the second press of the ID_CHECKING menu item, the caption changes to Selection" but part of the old (longer) caption remains painted on the screen. Also it looks like the new caption is on a totally new button. I made an educated guess at the parameters
Also tried mmenu->ModifyMenu(ID_CHECKING, MF_BYCOMMAND,ID_CHECKING, " Selection");
but same peculiar result. Helpp!!!
Thank you in advance,
ns
|
|
|
|
|
I'm writting code which fills up a character array with numeric values which will later be converted in to character values for use with an encryption function. The problem I'm having is that the array values do not seem to be making it into the array, and I'm pulling my hair out trying to figure what's going wrong. Source Code Follows
int nElementCount = 0;
int nElementValue = 0;
char szStringArray[] = "\0";
while ( nElementCount < 255 )
{
szStringArray[nElementCount] = nElementValue;
nElementCount++;
nElementValue++;
}
MessageBox(NULL, szStringArray, "Debug Message", MB_OK);
As can see the code is pretty straight forward, but I just seem to not be able to get values into the array. It's probably something simple that I'm missing due to newbie-itis. If someone could point out what's wrong with my code and how to fix it, I'd appreciate it.
It's good to see kids turning their minds to wholesum activities such as programming, instead of wasting their lives in the hedonistic disciplines of Sex, Drugs, & Rock & Roll... or Sex with Drugs, or Sex with Rocks while Rolling in Drugs, or whatever new-fangled perversions you little monsters have thought up now...
[Shog9 on Kid Programmers]
|
|
|
|
|
|
Sorry for the prev reply, but I just watched ugggh Event Horizon on TV [roughly 40% of the latter 60%] and am still not fully normal yet
John Aldrich wrote:
char szStringArray[] = "\0";
Change that to :-
char szStringArray[256] ;
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Just made that change. My dubug statement is still showing no values in the array. is there another check I can do to see if there actually are values?
It's good to see kids turning their minds to wholesum activities such as programming, instead of wasting their lives in the hedonistic disciplines of Sex, Drugs, & Rock & Roll... or Sex with Drugs, or Sex with Rocks while Rolling in Drugs, or whatever new-fangled perversions you little monsters have thought up now...
[Shog9 on Kid Programmers]
|
|
|
|
|
John Aldrich wrote:
Just made that change. My dubug statement is still showing no values in the array. is there another check I can do to see if there actually are values?
That's because nElementValue is initially 0 and you assign it as the first value of your array. Strings are 0-terminated. Thus your MessageBox won't come up because it sees a null string. Start with nElementValue = 32. 32 is space and 32 upwards is legal characters and stop at 127. otherwise you have all kinds of funny control chasracters which might end up as boxes in the text on screen or might have other bad side effects.
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Hi All!
How do you get/set the checked state of an item in a menu?
thx!
Nitron
_________________________________________--
message sent on 100% recycled electrons.
|
|
|
|
|
|
Can you give example on use?
thx.
Nitron
_________________________________________--
message sent on 100% recycled electrons.
|
|
|
|
|
|
do u know what functions or MFC classes are used for sending email and what platform or special servers or software are needed to support them as min required?
includeh10
|
|
|
|
|
|
|
A quick question for the STL gurus...
I've got a std::list, where the only insertion method is push_back(). I'd like the inserts to be as fast as possible. Is it worth keeping an iterator to the end of the list and using insert( end_it, foo ), or would it be just as fast, or faster, to simply use push_back( foo )?
I'm guessing that the list is optimised so that a call to push_back doesn't involve trawling through the entire list to find the end, but I thought I'd better check.
Oh, and I'm using the STL supplied with VS 6 SP5
TIA,
Pete
|
|
|
|