|
Hmm, I could have sworn Meyers explicitly states that not to be the case. However, testing shows you to be correct on your first point but not the second. All four variations result in the same thing.
When I get into work, I will check Meyer's book.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Ok, I checked Meyers and it was an attack of bad memory. He mentions this case:
std::string me;
me = "Bob";
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
|
Hi,
I am trying to create a simple Dialog Based form but have run into a problem that has me stumped.
My code is something like this:
HWND HWndParent;
WinMain(....) {
HWND HWNDStatus;
HWndParent = CreateWindow("PintrackrApp", "Pintracker",
WS_DLGFRAME|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX
|WS_BORDER, 200, 100, 600, 350, NULL,NULL,
hInstance, NULL);
HWndStatus = StatusBarCreate(hInstance);
ShowWindow(HwndParent,nShowCmd);
ShowWindow(HWndToolbar,nShowCmd); //This is fine
ShowWindow(HWndStatus,nShowCmd);
//Window message loop here
}
HWND StatusBarCreate(HINSTANCE hInstance) {
HWND StatusBar;
RECT rectTest;
int nArray[2];
int nParts;
InitCommonControls();
StatusBar = CreateWindow(STATUSCLASSNAME,"Test Status Bar",
WS_CHILD | WS_VISIBLE | WS_BORDER,
351,0,0,0,HWndParent,NULL,HInstance,NULL);
StatusDC = GetDC(HWndParent);
GetClientRect(HWndParent, &rectTest);
ReleaseDC(HWndParent, StatusDC);
nArray[0] = (rectTest.right)/2;
nArray[1] = (rectTest.right);
GetClientRect(HWndParent,&rectTest);
SendMessage(StatusBar,SB_SETPARTS,sizeof(nArray)/sizeof(nArray[0]), (LPARAM) (LPINT) nArray);
SendMessage(StatusBar,SB_SETTEXT,0(LPARAM) (LPSTR) "TEST STATUS MESSAGE");
SendMessage(StatusBar,SB_SETTEST,1,(LPARAM) (LPSTR) "Test Msg2");
return(StatusBar);
}
Everything compiles ok but when I run the program and display the window I don't see the status bar. If I maximize the window I see the Status Bar displayed about halfway down in my window. Both of the messages and partitions appear to be correct. The status bar is also only as wide as my Toolbar. It does not fill the whole width of my window.
I have tried searching MSDN & Code Project Fourms and the only thing I found suggested checking that my screen resolution is not smaller than my window. The screen resolution is 1024 x 768 and my windwo is 600 X 350. I am Stumped, I thought windows was supposed to be smart enough to place the status bar at the bottom of the window. Any ideas?
RWA
|
|
|
|
|
|
Huh? What does Clikety[^] mean?
|
|
|
|
|
|
Ok, once you explained it Clikety I was able to follow the link. Thanks.
I did some more research on this myself and finally figured it out . In the Platform(?) SDK MSDN doc it mentions that windows defaults it's positions for a new window based on the last window created. Since I was creating a Toolbar before the Status bar the Status Bar was placed in a position I didn't expect. I experimented a little and finally got the right positioning when I create the Status Bar BEFORE I create the Toolbar....
Thanks for your efforts....
|
|
|
|
|
How do i intercept any dialup connection attempts in Windows 95/98? For example, if you normally connect to the Internet thru dialup networking, how do you popup a messagebox before the "Connection" dialog appears? I've read something about API hooking, but I'm not possibly sure how this is done. Your help would be very much appreciated.
Feed your mind...
|
|
|
|
|
Hi!
Well I am looking for the same thing... I made an application for the dialup processes ( using RAS ). Well I don't know anything for intercepting the dialup connection requests... Well I didn't try it but what will happen if I try to open a dialup connection while I have a connection opened? Will it close the old connection automatically and connect the new one or send an error message? ( I can't try it right now cause I have no dialup modem right now... )...
Another thing is API hooking but someone warned me that it would slow down the system very much to filter all the requests made by all applications...
Please let me know if you find something about it!
Well... I am a beginner ...
|
|
|
|
|
looking for a quick way to dynamically change tooltip text--
I.E. change tooltip string text based on some other action
|
|
|
|
|
Have you tried CToolTipCtrl::UpdateTipText(...); ?
|
|
|
|
|
I'm looking at doing some VERY simple webpage parsing. My plan is to turn either the source or the output of the webpage into a text file, and then parse that. However, I do not know how to either get a pages source or output into a text file.
Any hints or better (as in simplier) methods would be well appreciated.
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
i'm not sure to understand...
htm, html, dhtml files and so on are pure text file !
for example, you can do this simple following thing : save this page (this one or another is you prefer) as an html file...
then, browse you hard disk toward the recently saved file. right click on the file and open it with Notepad... what do you see ? binary ? no of course.
you can submit your parser an htm file directly.
If you really need to have a txt file, you can simply change the extension (*.htm -> *.txt) or add the txt extension to the file name (*.htm -> *.htm.txt). whatever you want...
TOXCCT >>> GEII power
|
|
|
|
|
Not exactly what I mean. I wish to have a program go to a site, and then parse that. I want to only have to press a button to have it do all that...
I wish to use fstream to parse the page's text, but I can't figure out how to access the text through the program.
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
Have the program save a copy of the file (InternetReadFile) then use the fstream functions to read/parse it like it was any other file.
|
|
|
|
|
1) Open web page in Internet Explorer
2) From the menu select File/Save As...
3) In the "Save Web Page" dialog set "Save as type" to "TextFile (*.txt)
4) Give the file a name and a location and click the "Save" button
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
|
Hello all.
Help me please: I need to make a callback function as a member of my class (Win32 API, no MFC). Is it possible?
Thanks.
|
|
|
|
|
sure but it has to be static which means there is no object instance scope when the function is called.
-pete
|
|
|
|
|
Sorry, I can't fully understand the idea. Can you give a code example?
|
|
|
|
|
class base_w32thread{
protected:
HANDLE _handle;
DWORD _dwTID;
base_w32thread():_handle(0), _dwTID(0L){}
virtual ~base_w32thread()=0;
public:
bool start(LPSECURITY_ATTRIBUTES psecattrs = NULL, DWORD dwCreateFlags = 0L);
operator HANDLE(){ return _handle; }
protected:
virtual void run()=0;
virtual void onEndThread(){}
static long WINAPI threadfnc( LPARAM lp);
};
threadfnc is the callback that is sent as the argument to CreateThread() below
bool base_w32thread::start(LPSECURITY_ATTRIBUTES psecattrs, DWORD dwCreateFlags){
assert( !_handle);
if( _handle)
return false;
_handle = ::CreateThread( psecattrs, 0,
(LPTHREAD_START_ROUTINE)threadfnc, this, dwCreateFlags, &_dwTID);
return (_handle)?true:false;
}
Then in the callback function there is no "this" pointer so we have sent the object pointer as the User Parameter to CreateThread and we cast it to the correct type
long WINAPI base_w32thread::threadfnc( LPARAM lp){
assert( lp);
base_w32thread* pThis = (base_w32thread*)lp;
if( pThis)
pThis->run();
pThis->_handle = 0L;
pThis->onEndThread();
return 0L;
}
Hope that helps
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Thanks a lot. I'll try my best.
|
|
|
|
|
|
Just curious... is CALLBACK exaactly the same ad __stdcall? Can I use them interchangeably?
|
|
|
|