|
My MenuBar class use the HMENU ant the ::TrackPopupMenu, the problem is not with the HMENU command, is with the ::TrackPopupMenu, i'm writing my own menu class, but this is not a menu, is a window that acts as a menu, and when i use the ::TrackPopupMenu, i get the classic menu made by Windows, how can i make that the ::TrackPopupMenu shows my menu(fakemenu)?.
|
|
|
|
|
I am trying to create a borderless window that will just be display text of statis and will close by itself if statis is positive. The window will only display buttons to handle error and will have another chance to close app. And no taskbar button.
I have VS.NET but using VC++ 6.0 code(Win32API only). I have tried calling CreateWindow() with many different window styles but some work but not like I wanted and others build stops at the end of building and doesn't switch over to debug mode.
Note: if the backgroud was white and I was to run it windows should only paint white over the current screen.
Any help.
Real World Coding:
POP& BuyAPop(Money ADollar){...};
|
|
|
|
|
Omit the border styles (WS_BORDER, WS_THICKFRAME, etc.) and add the extended style WS_EX_TOOLWINDOW.
--Mike--
Actual sign at the laundromat I go to: "No tinting or dying"
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
Thank for reply...
Your reply help up to here...
I changed the style param for CreateWindow() to 0.
I added SetWindowLong(...,GWL_STYLE, 0);
and SetWindowLong(...,GWL_EXSTYLE, 0);
All that has change is I can drag window, curved ends XP titlebar and all borders are gone are gone(or transparent). The only thing is left is the titlebar is still painted and when Debuging and VS.NET is maximized and program is below it
Two thing I can do...
1) I DbClick VS.NET caption and some of my program show but VS.NET UI is not erase from non-client area.
2) I click my program taskbar button and only the client area of appears on top(non-client area seems transparent). This is what I wanted along.
Also I still cant get rid of that taskbar button.
Any more help...
Thanks...
Real World Coding:
POP& BuyAPop(Money ADollar){...};
|
|
|
|
|
Would it be easier to create a hidden parent window and just have the child borderless window display.
Real World Coding:
POP& BuyAPop(Money ADollar){...};
|
|
|
|
|
Use ModifyStyle(..)
Or ModifyStyleEx(..) to change the window style.
Regards
http://www.ucancode.net/
|
|
|
|
|
I'm trying to post a meesage from one class to another, passing a CString value with the message. Currrently, I casting the CString into a LPARAM and passing that. Then in the function that receives the meesage, I'm casting the LPARAM into an LPCTSTR/CString.
The LPARAM value is passed across correctly, but when I recast back to the LPCTSTR, the data is garbage.
Any ideas on what I'm doing wrong?
// posting function
CString myStr = _T("some data");
LPARAM lParam = (LPARAM)myStr;
::PostMessage(HWND_BROADCAST, WMU_MY_MSG, 0, lParam);
// receiving function
LPCTSTR lp = (LPCTSTR)lParam;
lp holds garbage data.
Thanks!
|
|
|
|
|
Is the class that you are sending the CString to in a different process? Memory is not valid across process boundaries, you will need to allocate memory using the GlobalAlloc function, then copy the data from the CString into your new buffer.
If this is not the case, could you give more details as to why you are using HWND_BROADCAST.
Good Luck
Checkout my Guide to Win32 Paint for Intermediates
|
|
|
|
|
Not in a different process, as far as i know.
Using HWND_BROADCAST because...uhh.... why AM i using it? I'm not sure, i think it's because it worked when i was playing around with different values.
I'll try the GlobalAlloc anyways.
Thanks!
|
|
|
|
|
I just noticed something that I think is your problem. You are creating a CString on the stack inside of a function, then you are posting a message. The function call that all of this is happening in will exit before the posted message gets handled. When the function call exits, it destroys all of the variables that were created on the stack for that function.
There are three ways to solve this:
1) Make your CString a global variable.
2) Dynamically allocate the CString class, and delete it at a later time (this could get messy though, deciding who should actually delete the string, it should not be deleted until the posted message is handled.
3) Use SendMessage instead of PostMessage. SendMessage happens instantly, and does not return until the message is handled by your target window.
Good Luck
Checkout my Guide to Win32 Paint for Intermediates
|
|
|
|
|
Heh, yeah, silly me. I noticed the same error, then smacked myself on the head a few times because it's so simple, yet i couldn't get it to work. Yeah, i think i need more sleep
Thanks for all your help too.
|
|
|
|
|
You got it! The CString object must be created on the heap and deleted by the other thread that receives the message in the message handler. Read
Using Worker Threads. It describes this mechanism in detail.
Best regards,
Alexandru Savescu
|
|
|
|
|
By the way, HWND_BROADCAST is OK to use, but it will send this message to every top level window currently on the system. Therefore it may cause problems if the user is running more than one instance of your application and the second instance tries to handle this message. Also it will use more processing power each time this message is used. Maybe not enough to matter though.
It would be better for you to see if there is a way to get a handle to the window that you are interested in receiving the message.
Checkout my Guide to Win32 Paint for Intermediates
|
|
|
|
|
When i wasn't using HWND_BROADCAST, then the receiving function never receiving the message. I'm sure using HWND_BROADCAST is overkill, but it's the only way i could find (right now) to make sure the receiving function gets the message, especially since the sender function doesn't have the handle to the window that receives the message.
|
|
|
|
|
Hello People...
In VC 6 there was a way to bring up a dialog of all available insertable components, ie Splash Screens, Property Sheets, etc.
Is there an equivelant in VS.Net?
Thank you People.
Frank
|
|
|
|
|
Click right mouse on toolbox and select "Customize ToolBox.."
Regards
http://www.ucancode.net/
|
|
|
|
|
Thanks for the info Jack, but...
In VC 6 you could click on a component ie the Property Sheet, and be presented with a wizard to insert one into your project.
I may have missed it, but I don't think I saw that in the Toolbox.
Any ideas?
Thanks,
Frank
|
|
|
|
|
Can anyone give me the syntax for getting a random number?
I'm too lazy to check myself, something with RND, isn't it?
That's what happens when you use VB for too long...
Isaac Sasson,
Lean, mean posting machine!
Sonork ID 100.13704
|
|
|
|
|
srand(time(NULL)) to seed the generator, then rand() to generate a number.
--Mike--
Actual sign at the laundromat I go to: "No tinting or dying"
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
Thanks!
I almost used the Basic syntax:
<br />
RANDOMIZE TIMER<br />
X=INT(RND*24)+1<br />
Isaac Sasson,
Lean, mean posting machine!
Sonork ID 100.13704
|
|
|
|
|
In my BASIC it would be
X = RND(-TI): REM seed
X = INT(RND(0)*24) + 1
Guess which computer I used when I was a kid
--Mike--
Actual sign at the laundromat I go to: "No tinting or dying"
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
Michael Dunn wrote:
Guess which computer I used when I was a kid
It was a waffle iron!
Jeremy L. Falcon
"The One Who Said, 'The One Who Said...'"
<nobr>
Homepage : Sonork = 100.16311 01000010011011110110001000100000011101110110000101110011 00100000011010000110010101110010011001010010111000000000
|
|
|
|
|
Michael Dunn wrote:
Guess which computer I used when I was a kid
>=1 of {TRS-80, Commodore, VIC-20 or Atari}?
/ravi
|
|
|
|
|
Ravi Bhavnani wrote:
>=1 of {TRS-80, Commodore, VIC-20 or Atari}?
The usage of the reserved variable TI should give it away. C=64 then later C=128.
--Mike--
Actual sign at the laundromat I go to: "No tinting or dying"
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
I have socket listening on a port.
Using telnet, I connect to the socket, it then accepts the connection to a
'client' socket.
In the client socket's class (derived from CSocket), I have the OnReceive
function overriden to post a message back to the main dialog window whenever
I can read from it.
Now, when I type something in my telnet window and hit enter, shouldn't that
'send' it to the socket to receive?
But it doesn't ever get called. I set a breakpoint and debugged it. Just
acts like nothing is ever sent to the socket from my telnet. I can send
FROM the socket and the text will be displayed correctly on the telnet
window...
This was tested on Windows XP if it makes a difference.
The server I am writing is a POP3 server.
So, just to test that telnet wasn't just wacko, I also had Outlook Express
connect. It received my intial welcome message, but I never receive OE's
command.
Any ideas?
Adam Clauss
cabadam@tamu.edu
|
|
|
|