|
Heh, woops called the wrong function to set the pSf, i have to call
SHGetDesktopFolder (&pSf); thanks for the help :=)
|
|
|
|
|
You are welcome.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
u are sooooo diplomatic joaquin
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
I have had a problem programming in Windows for some time which I have never solved and would appreciate anybody's help !! I shall describe the current incarnation !!
I am writing an application (using MFC and VC++) using the Document/View architecture. Within a Document/View process, I need to produce a secondary window (to the view) to display certain other information. I invoke this via a menu item associated with the View, and have tried to display this secondary window by using the following statements within the menu routine:
void CIRCView::OnMenuItem()
{
// TODO: Add your command handler code here
CIRCDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if(!m_bButtonSelected)
AfxMessageBox("Please select a key to adjust");
else
{
CRect rect(20,20,100,100);
CWnd Wnd;
int rc;
rc = Wnd.Create(NULL,NULL,
WS_CHILD | WS_VISIBLE | WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL,
rect,(CWnd*)GetParent(),NULL);
}
}
I get a good (non-zero) return code from Create(), but no new window (apart from the View) is visable (if I add a Wnd.ShowWindow(), it returns that the window WAS already visable !).
Where am I going wrong ??? (Any help appreciated on this trivial, but important, question will be greatly appreciated !!)
Doug
|
|
|
|
|
Your CWnd variable is local, so it gets destroyed as soon as you exit OnMenuItem .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquin, Many thanks for your response - I'm now kicking myself because it's so obvious !! (the simple ones always are !!!) Thanks again
Doug
|
|
|
|
|
whatever.cpp(41) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1794)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Error executing cl.exe.
as if this isnt hard enough as it is!!!
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
This is a (unfortunately) rather common situation as soon as you get serious at writing templatized code. Namespaces make VC++ have a hard time, too.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
When I have a normal Win32 program, where can I intercept the messages from child controls as WM_CREATE, WM_CLOSE, WM_PAINT, etc... withing the
LRESULT CALLBACK(HWND hWnd, MSG message, WPARAM wParam, LPARAM lParam){}
function of the main window.
Where can I find the HWND of the child control (I presume lParam), the message itself (is it message or something in the wParam)?
N.B. I know how to get the messages from i.e. a button like BN_CLICKED, BN_DBLCLK, etc...
LPCSTR Dutch = "Double Dutch "
|
|
|
|
|
You will need to subclass that child control if you want its Windows Messages (WM_XXX). The BN_ messages that you are recieving are called notifcations that get sent to the parent window.
When you subclass a window, you are basically placing your own WindowProc in the place of the original window proc for the child control. This will allow you to override any functionality that you want to, then pass the messages that you do not care about to the original window proc.
Look up sublcassing, and SetWindowLong in MSDN.
Good Luck!
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Is it also possible to set the WindowProc method into a class? And how can I connect this to the WNDCLASSEX struct? (Because (WNDPROC)WindowProc won't work)
LPCSTR Dutch = "Double Dutch "
|
|
|
|
|
(this was a reply to a lounge post, but given that i'm now posting code, i'm replying here )
Here's some code (C++/MFC) to implement the effect; you can put it in a timer handler, loop, etc. just put a delay of some kind in so it doesn't get called too fast.
static int rot = 0;
static const COLORREF colors[] = { RGB(255,166,166),
RGB(244,244,176),
RGB(179,245,175),
RGB(175,245,245),
RGB(189,174,247),
RGB(243,177,201),
RGB(204,183,238),
RGB(189,232,220),
RGB(237,184,184),
RGB(255,241,166),
RGB(166,253,255),
RGB(166,255,170),
RGB(172,166,255),
RGB(241,166,255),
RGB(233,188,192),
RGB(222,197,224),
RGB(198,219,223),
RGB(203,228,192),
RGB(228,192,192),
RGB(187,194,234)};
static const int NumColors = sizeof(colors)/sizeof(COLORREF);
static const int SysElements[] = { COLOR_3DDKSHADOW,
COLOR_3DFACE,
COLOR_3DHILIGHT,
COLOR_3DLIGHT,
COLOR_3DSHADOW,
COLOR_ACTIVEBORDER,
COLOR_ACTIVECAPTION,
COLOR_APPWORKSPACE,
COLOR_BACKGROUND,
COLOR_BTNTEXT,
COLOR_CAPTIONTEXT,
COLOR_GRAYTEXT,
COLOR_HIGHLIGHT,
COLOR_HIGHLIGHTTEXT,
COLOR_INACTIVEBORDER,
COLOR_INACTIVECAPTION,
COLOR_INACTIVECAPTIONTEXT,
COLOR_INFOBK,
COLOR_INFOTEXT,
COLOR_MENU,
COLOR_MENUTEXT,
COLOR_SCROLLBAR,
COLOR_WINDOW,
COLOR_WINDOWFRAME,
COLOR_WINDOWTEXT };
const int NumSysElements = sizeof(SysElements)/sizeof(int);
COLORREF SysColors[NumSysElements];
for (int i=0, c=rot; i<NumSysElements; ++i, ++c)
{
if ( c >= NumColors )
c = 0;
SysColors[i] = colors[c];
}
::SetSysColors(NumSysElements, SysElements, SysColors);
++rot;
if ( rot >= NumColors )
rot = 0;
If the colors i've used aren't psychodelic enough for you, just modify colors appropriately.
--------
From now on we can call C# and MC++ "The square wheel languages" -- Jack Handy, The Lounge
|
|
|
|
|
mIRC plugins communicate with mIRC via an so called 'DDE server'.
I wonder what is it, how does it work and how do I program an own server/client?
thanks for help!
|
|
|
|
|
DDE (Dynamic Data Exchange) was the forerunner to COM. It allows applications to communicate with each other. A search on MSDN should answer your technical queries. The DDEML library will allow you to write your own DDE Server and clients, although COM would be the better approach.
Michael
|
|
|
|
|
It stands for Dynamic Data Exchange. It is a way to create interprocess communication with windows operating systems. It was really big for Windows 3.1. It works through the messaging system built into windows.
It is a somewhat simple mechanism, but if you can avoid using it I would use some other tool. There are better methods now. You could even use COM / OLE which provides a ton more features, and isolates you from alot of the details for client server programming.
If you are set on using DDE to create an mIRC plugin, you can start by looking up the WM_DDE_ family of messages in MSDN or msdn.microsoft.com. I know there is a very basic sample of a DDE client / server program in Charles Petzolds Programming Windows book.
Good Luck.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
hmmmm
client / server stuff ... unicode ... tcp/ip just transfers streams of bytes that can be TCHARS or whatever else u want them to be ... should one make the client / server work in char's and do the conversions / scaling of buffers in code or should one work in TCHARs and do the opposite?
just seems a real pain using unicode with tcp/ip
prolly not the clearest post i know
"... and so i said to him ... if it don't dance and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
I think that it all depends.
Who are your users , will they require a lot of UNICODE support, or are you just thinking ahead?
There are basically two ways to go:
1) Are you sending a lot of text across the socket frequently? Because if you are only sending a couple hundred characters then I would say it is not worth worrying about and I would deal with it in TCHARS. The drawback to this is that you will need to deploy two versions of your server and client, or at least they will need to differentiate between the two different types of packets that you send. WCHAR vs CHAR.
Another alternative to think about is to compress your text data before you send it. For most of the latin based language locales, all of the extra bytes in the UNICODE strings will be easily compressed. But you will still need to have two versions of the client, one ansi and one unicode.
2) If you are sending megabytes of characters, and you can spare the processing power, then you may want to consider reducing the data to CHAR data types, however you will want to make sure to use the multibyte conversions in order to prevent the loss of data for locales that actually depend on the UNICODE format.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
thanks
yah its kinda thinking ahead and the fact that i always code in unicode ... its kinda a habit these days
the traffic is not great so maybe just grim it out with wierd buffer manipulation code
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
Hi,
I'm writing a program that takes text from a file, and converts it to HTML. At first I tried using the CStdioFile::Replace() function, but that didn't work cause I don't need to replace everything. I think what I need to do, is Find() a certain string, and then Insert() something before it. The only problem is I can't get past the first line.
Say I make CStdioFile Story, fill it with a story about pies, then do this:
int pos;
pos = Story.Find("pie", 0);
Story.Insert(pos, "apple ");
That works fine, but it only does it once. What should I do if Story is full of 'pie' and I want to change it all to apple pie?
Thank you, any help would be appreciated.
|
|
|
|
|
I could be completely wrong, but after searching the documentation I couldn't find any member functions called Find nor Insert in CStdioFile or its base classes.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
You're right, and I'm an idiot. I mean CString, sorry.
|
|
|
|
|
See the replaceAll() method in this article.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I've got an assignment that says make a game of blackjack. Use random numbers, loops, arrays, functions, ect. Any advice would be greatly appriciated. Thanks
|
|
|
|
|
Is this an assignment for a windows program, or a console app.
If you are using windows you can find the images for the cards in cards.dll.
Otherwise, if this is for homework, I would be glad to guide you in the right direction if you tell me what your initial ideas are.
Good Luck.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hi kilowatt.
I have a question about it.
kilowatt wrote:
If you are using windows you can find the images for the cards in cards.dll.
How can I get some images from a dll file?
Thanks
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|