|
Hi,
I have a custom slider control derrived from CSliderCtrl. It basically overrides the appearance of the slider. However the dialog containing this slider does not receive any messages on horizontal (or vertical) scroll. When I insert other default sliders the function does get triggered so I don't think my message map is wrong. Any ideas?
I've considered adding my own message, however I'd like to understand and keep things more consistent. Can I post a WM_HSCROLL message manually when changes occur to this slider? How would I do that? And in general for buttons and sliders is it the object that posts the message to parent window or the windows system that sends the message to the button/slider object and it just happens to pass by the parent dialog first which you catch?
Thanks
|
|
|
|
|
May be of help:
http://www.codeproject.com/listctrl/synchscroll.asp
|
|
|
|
|
Problem: I need to create a Client/Server Application.
[Server] Winsock host, MS SQL 7/2000 connectivity. The server must accept multiple connections and return database query results in text/xml
help examples may have an access database.
[Client] Winsock Client, Convert text/xml data from server into recordset. These rescordset will be displayed on forms in an MDI environment on a Win32 platform
Current Status: I can create the above scenario in Visual Basic. I need to create it in Visaul C++ because I understand one has more control of winsock in C++.
I have tried to use VB-to-C++ converters this was no help
I have tries combining bits and pieces of samples from this site and the most successful was using NDK, DAO, ATL and Dialog based. Tried converting it to MDI then all hell broke lose.
Reason: I have and application developed in visual basic that uses the data environment connections, and reports using Seagate Crystal. This application run over a WAN/LAN (two cities) the connection is slow especially when trying to get a recordset
|
|
|
|
|
I'm modifying a directx sample (MOIRE.scr) screensaver. I'm making it where when the screensaver would usually end, it's popping up a dialog that I made. A company we do work for would like to have a screensaver running on machines for walk-ins that they allow to use their resources, but for statistical purposes they would like all users to log in. I need my dialog to show so that the user can log in if they're registered, or sign up if they're not. The problem is that when the screensaver stops, it just blanks out. If I hit ctrl+alt+delete to bring up the task manager, the taskbar is visible and I can see the dialog listed in the taskbar, it's just not visible. I've tried SetForegroundWindow, SetWindowPos, and SetFocus, but none of them seem to work. Can anyone help me with this problem?
[insert witty comment here]
bdiamond
|
|
|
|
|
I'm in the process of adding a separate thread for a certain type of processing done in an app which deals with very large files (sometimes more than 1GB), and can take several minutes. The app has been an ongoing project for the last several years, should have been done as a multi-threaded app to begin with, but I'm coming in a bit too late to think about that
Anyway, with a ton of help from searching around the message board here (thanks!) I've spawned the processing off to a different messaging thread, which has two messages it can respond to UWM_START and UWM_STOP. While processing, it responds back to the main thread with UWM_UPDATE_PROGRESS and then UWM_DONE_PROCESSING when finished. For the most part this works well. UWM_START kicks off the long processing and it periodically has a message pump loop it does so that if UWM_STOP is sent it can respond to it. This part is working well, but I'm having a problem with code that is shared between this thread and the main thread.
The part that is spawned off shares A LOT of code with the rest of the project, the shared code contains many message pumping loops (which are needed because of the fact it was done as single threaded to begin with). When I comment out thoes message pump loops (and leave the one in the processing thread), everything works great. However, if those message pump loops are in there, then I get a couple of weird errors. This doesn't really make sense though, since the documention of the message functions indicate it's done on a thread-by-thread basis, so I shouldn't be messing any of the messages up. ... and why would one pump be ok, and more cause problems?
My question is, are these extra message pump loops causing me problems, or are they just helping uncover some larger flaw with all the shared code?
BTW, the message pump loops are implemented as suggested in many places on the board:
MSG msg;<br />
while(::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)<br />
AfxGetThread()->PumpMessage();
-----
In the land of the blind the one eyed man is king.
|
|
|
|
|
Does the new thread do any UI stuff? My preference with threads is to use worker threads, not UI threads and get the main app to do any UI on behalf of the worker thread.
Why do you need these message pump loops at all. This sounds like stuff we used to do back in the Win16 days to do mock background processing. I'd be trying hard to get rid of them all.
Far out - new formatting buttons.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
The thread is technically a UI thread (as it's derived from CWinThread), but this is simply to use messaging. This allowed much cleaner handling of cancel and update code than what I was trying before with a strictly worker thread, and use of messages is going to allow me to do a little more with this thread than I am now. The main thread handles everything in the UI.
Neville Franks wrote:
Why do you need these message pump loops at all. This sounds like stuff we used to do back in the Win16 days to do mock background processing. I'd be trying hard to get rid of them all.
This technique is actually talked about and recommended in several articles here on CodeProject, but you're right - that's basically what it is doing, these message loops are there for tasks that should have been spawned off as background tasks long ago but never were. I tried simply removing the loops via #ifdefs, all my crashes stopped but I then had user responsiveness problems when doing the tasks that are still in the main thread. Although I'm going to push that these other tasks get dropped into separate threads, it won't happen anytime soon so I'm rather stuck with them for now. Perhaps there is some subset of the loops that I can remove, but until I can figure this out I'm not going to be too confident of this thread.
I still can't really figure out why the loops are causing problems. From everything I've read they should be OK.
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
If the thread doesn't do UI I'd definitely use a worker thread. Then use PostMessage() to communicate with the main app thread. If you can add a flag param to the common code functions that do the message pump that says whether to pump or not you can set this to false for your thread. Alternatively use this:
BOOL
InAppThread()
{
return ( AfxGetApp() eq AfxGetThread() );
}
and then:
if ( InAppThread() )
do message pump ..
Also look at http://www.codeproject.com/threads/threadlibrary.asp[^] which is very nice and also simple.
Threads are way better and cleaner for CPU intensive tasks than trying to do this in message pumps. Of course you have to consider sychronization and potential deadlock issues as well. Welcome to the world of multithreading.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
That little code snippet will be perfect for getting around those message loops for now, but I'll be pushing for doing this all in threads, and the link you provided looks like it may be about perfect for that.
Thanks!
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
I'm glad I was able to be of help. There is an article here at CP by Newcomer about Worker Threads which you should read. Make sure you don't use SendMessage from thread, instead always use PostMessage(). All to do with deadlocks.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
I have a little question. What happens exactly in these several case:
case 1:
int* pVar = new int;<br />
void* pPointer = pVar;<br />
delete pPointer;
case 2:
char* szString = new char[Value];<br />
void* pPointer = szString;<br />
delete pPointer;
case 3: (the most interesting)
CMyClass* pClass = new CMyClass;<br />
void* pPointer = pClass;<br />
delete pPointer;
Of course, the question is how will the compiler handle the destruction of the different objects ?? In the third case, does he 'know' that it will need to call the destructor of CMyClass ?
|
|
|
|
|
The rule is simple. Calling delete on a void pointer frees the memory pointed to by the pointer (regardless of what type it is), but never calls any destructors.
Note that the actual object type pointed to makes no difference. The runtime library keeps track of the size and base address of each memory block allocated, and uses these to free the memory properly. It doesn't care what the memory contents is or what type of object it points to.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ok, thanks. It's clear now .
So this is safe to use such a technique with basic types (not arrays) but not safe with classes...
|
|
|
|
|
cedric moonen wrote:
So this is safe to use such a technique with basic types (not arrays) but not safe with classes...
Well, I certainly wouldn't call it 'safe'. It violates the rules of type-safe programming and is IMO a very, very bad design. If you have any other way of doing things, do it.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
how can I get current language which the window user is using? Can I also query the list of languages that are selected in IE (e.g. english first, next german if first not availble)?
Thanks
|
|
|
|
|
Chech out GetKeyboardLayout Function
How to detect when this change happen use WM_INPUTLANGCHANGE message
Ivan Cachicatari
www.latindevelopers.com
|
|
|
|
|
Would any of the following help:
GetLocaleInfo()
GetACP()
GetUserDefaultLangID()
GetUserDefaultUILanguage()
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks, I will have a look at these.
Anonymous
|
|
|
|
|
I have downloaded a example for VMR9,when compiling the project,error shows:
error LNK2001: unresolved external symbol _IID_IVMRWindowlessControl
it means this project should include some .lib,what is it?
thanks a lot
|
|
|
|
|
How can I push out my app to the rest of the user in the LAN? So they can run my app.
|
|
|
|
|
hi, in correspodace to my graduation project i need a progarm that converts monochrome bitmaps to a 2-D array ... i would be glad if u could help me .
your's faithfully
|
|
|
|
|
Hi,
Normally bitmaps are stored in 1D arrays.
For exemple you have 640x480 bitmap, the way to get to a pixel would be like this:
<br />
char bitmap[640 * 480];<br />
<br />
bitmap[x+(480*y)] = value;<br />
If you want to convert the exemple above to a 2D array, you can do the following:
<br />
char bitmap[640*480];<br />
char bitmap2D[640][480];<br />
<br />
for( int y = 0; x < 480; y++ )<br />
for( int x = 0; x < 640; x++ )<br />
bitmap2D[y][x] = bitmap[x + 480 * y];<br />
Hope this helps..
|
|
|
|
|
I have a written a header file in the same directory as the .net project. compile time it says cannot find the header file, 'no such file or directory'. I has been added to the headers directory in the project. What have I not done, or whats wrong. Please help.
|
|
|
|
|
Go to the line where you include your header file an check the spelling of the file / class and the problem should be solved
Pascal
|
|
|
|
|
And your question is?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|