|
I have a list control object and I add a notification handler for double-clicks (VC.NET). The problem is that I never receive the notification.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
AFAIK, WM_LBUTTONDBLCLK won't work for list box'es!
Use the following:
ON_LBN_DBLCLK(IDC_MYLISTBOX, OnDblclkMyListBox)
If you are using Wizards, it generates this code. There shouldn't be any problems.
Mustafa Demirhan
http://www.macroangel.com
Sonork ID 100.9935:zoltrix
<nobr>They say I'm lazy but it takes all my time
|
|
|
|
|
Is there a possibility to create a MetafileDC without clip region ? All metafiles derived from ClientDC or ScreenDC have an implicit "desktop-size" clip region.
My problem:
Metafiles, created from our graphic displays, do not include all graphical objects, if the graphic display has dimensions larger desktop size. Missing are WMF-based objects, which are drawn by PlayEnhMetafile(). Debugging shows, that these objects are processed and that PlayEnhMetafile() does not return an error.
I assume, that the WMF data is clipped, if these objects' origin are outside the device dependent clip region.
The problem would be solved, if I could define a MetafileDC with a clip region equal to the dimensions of the graphic display.
|
|
|
|
|
You create an enhanced metafile by CreateEnhMetaFile (CreateMetaFile is only leftovers for Win16 compatibility)?
This call creates one HDC.
I see no mention in the documentation that it should in any way or form clip to the desktop size. But if it does, you might try a call to SelectClipRgn with a NULL region.
|
|
|
|
|
Using ATL Server for Web Service may be a choice for speed when comparing with other Web Service methods, but when I
using it to make a test, I met a strange problem, My idea is put the image processing methods on the Server, the client can load image data, and then access the server for processing. since only for testing, I define only one method:
HRESULT SobelProcessH([in]LPSTR lpImage,[out,retval]lpImageOut)
I also presented the realization for this SobleProcessH function on the server, then I add a project for WebSetup, build them, so the service is done, when I begin to create a client project to access the service, the problem came out:
first I added a client project, then I added Web Reference for the Web Service, after that the proxy builded and output a .h file for me, but in that .h file, I found the SobelProcessH function having three parameter other than two,another parameter
int lpImage_size
was found in the function.
you know I define the function with two parameter in the server side, why did this happen? what kind of type should I use for transfer image in the functions based on SOAP and XML?
victorswan
|
|
|
|
|
Hi:
we can use winpopup.exe to send net message to other peer in win9x,while in winNT/2000,we use "net send ...".
Winpopup.exe use windows mailslot to read/write message,the question is how winNT/2000 read/write message from network? does it use namedpipe?
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
I'm pretty sure "net send" uses SMB (the horror).
A starting point might be Q168893.
For more info I'd point you to the samba project (no url, but googling should get you there).
|
|
|
|
|
No, it also uses NetBios(), which actually means it uses mailslots.
The "net send" thing is there since the very first days of Windows for Workgroups and interoperable between all OS that support SMB (they all use the same mailslot for it).
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
I read long ago, and forgot... one way to integrate the platform SDK help into VS help, thus one can access it directly pressing F1. Does anybody know how to or whether is it still possible with the latest SDKs?
Thanks,
Javier
|
|
|
|
|
The last PSDK I downloaded (July) included a menu item under Start/Programs/Microsoft Platform SDK called Visual Studio Registration. The function Register PSDK... worked well in VS6. I don't know if it works with VS.NET, but it's worth a try.
|
|
|
|
|
Yes, I know that option, but it is only meant to include for you the source, headers and lib paths into VS options.
I believe what I want is way more tricky to do something with registry keys.
Thank You anyway!
|
|
|
|
|
Check this out:
http://www.codejock.com/developer/article01.htm
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
Yesss
That's what I was looking for!
Thank You!
|
|
|
|
|
I don't know if this would work the same way it worked for me.
I alaredy had MSDN library, so after instalig PSDK Ive changed the folowing keys in registry (WinXP):
HKEY_LOCAL_MACHINE\SOFTVARE\Microsoft\HTML Help Collections\Developer Collections\0x0409\0x035eef540
Default: Name
Filename: path to the sdk .col file
|
|
|
|
|
Please send me one.
Thank you very much!
Best regards!
msn: nevergrief@hotmail.com
C++ lover ,haha
|
|
|
|
|
|
Let me confess that I am a novice VC++ programmer.
I wrote seperate functions in regular MFC dll having following signatures -
1. extern "C" ADODB::_RecordsetPtr declspec(dllexport) GetRs()
2. extern "C" declspec(dllexport) GetRsEx(ADODB::_RecordsetPtr &rs)
Both the functions work as expected when accessed through the exe created in VC++.(i.e I am able to access the recordset)
However when i try accessing them through the VB application the #2 work as expected but the #1 gives memory error.(Probably bcoz of the _RecordsetPtr going out scope
which i have declared inside the function).
Can any one explain the way in which i can return the recordset instead of using parameter by reference(OR using the #1 declaration)?
thanks and regards,
MS
|
|
|
|
|
This program is example from book and I assume I retyped it correctly, but there is a problem which I don't understand its reason.
Program, regardles main thread, creates four other, and when I run the program on WinXP it practically hangs the system, but it runs. CPU usage is 100% and I cannot (or I must wait a long while) do anything else. I cannot move/resize or quit the program, and finally I must kill program directly from Windows Task Manager.
I do not have to much experience on using threads but I assume that (like the book writes, and for example a much more slower machine like 386 or 486) that for systems like mine (AMD TB 1GHz, 256MB RAM...) it is not too much overhead if program creates four other threads, and that it should run smoothly as much as any other program of that form.
VC of course compiled this program with no error or warning in report. I seems that everything is OK in code. But it is not!
So I'm asking for your help to resolve this problem.
Here's the code (again I apologize for text length but I cannot clip the critical part since I don't see which one is it ):
#include <windows.h>
#include <math.h>
#include <process.h>
typedef struct
{
HWND hwnd;
int cxClient;
int cyClient;
int cyChar;
BOOL bKill;
}
PARAMS, *PPARAMS;
LRESULT APIENTRY WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT("Multi2");
HWND hwnd;
MSG msg;
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = szAppName;
if (!RegisterClass(&wc))
{
MessageBox(NULL, TEXT("This Program Requires Windows NT!"),
szAppName, MB_ICONERROR);
return 0;
}
hwnd = CreateWindow(szAppName, TEXT("Multitasking Demo using Threads"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL);
ShowWindow(hwnd, iCmdShow);
UpdateWindow(hwnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
int CheckBottom(HWND hwnd, int cyClient, int cyChar, int iLine)
{
if (iLine * cyChar + cyChar > cyClient)
{
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
iLine = 0;
}
return iLine;
}
void Thread1(PVOID pvoid)
{
HDC hdc;
int iNum = 0, iLine = 0;
PPARAMS pparams;
TCHAR szBuffer[16];
pparams = (PPARAMS) pvoid;
while (!pparams->bKill)
{
if (iNum < 0)
iNum = 0;
iLine = CheckBottom(pparams->hwnd, pparams->cyClient,
pparams->cyChar, iLine);
hdc = GetDC(pparams->hwnd);
TextOut(hdc, 0, iLine * pparams->cyChar, szBuffer,
wsprintf(szBuffer, TEXT("%d"), iNum++));
ReleaseDC(pparams->hwnd, hdc);
iLine++;
}
_endthread();
}
LRESULT APIENTRY WndProc1(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static PARAMS params;
switch (message)
{
case WM_CREATE:
params.hwnd = hwnd;
params.cyChar = HIWORD(GetDialogBaseUnits());
_beginthread(Thread1, 0, ¶ms);
return 0;
case WM_SIZE:
params.cyClient = HIWORD(lParam);
return 0;
case WM_DESTROY:
params.bKill = TRUE;
return 0;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
void Thread2(PVOID pvoid)
{
HDC hdc;
int iNum = 1, iLine = 0, i, iSqrt;
PPARAMS pparams;
TCHAR szBuffer[16];
pparams = (PPARAMS) pvoid;
while (!pparams->bKill)
{
do
{
if (++iNum < 0)
iNum = 0;
iSqrt = (int) sqrt(iNum);
for (i = 2; i <= iSqrt; i++)
if (iNum % i == 0)
break;
}
while (i <= iSqrt);
iLine = CheckBottom(pparams->hwnd, pparams->cyClient,
pparams->cyChar, iLine);
hdc = GetDC(pparams->hwnd);
TextOut(hdc, 0, iLine * pparams->cyChar, szBuffer,
wsprintf(szBuffer, TEXT("%d"), iNum));
ReleaseDC(pparams->hwnd, hdc);
iLine++;
}
_endthread();
}
LRESULT APIENTRY WndProc2(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static PARAMS params;
switch (message)
{
case WM_CREATE:
params.hwnd = hwnd;
params.cyChar = HIWORD(GetDialogBaseUnits());
_beginthread(Thread2, 0, ¶ms);
return 0;
case WM_SIZE:
params.cyClient = HIWORD(lParam);
return 0;
case WM_DESTROY:
params.bKill = TRUE;
return 0;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
void Thread3(PVOID pvoid)
{
HDC hdc;
int iNum = 0, iNext = 1, iLine = 0, iTemp;
PPARAMS pparams;
TCHAR szBuffer[16];
pparams = (PPARAMS) pvoid;
while (!pparams->bKill)
{
if (iNum < 0)
{
iNum = 0;
iNext = 1;
}
iLine = CheckBottom(pparams->hwnd, pparams->cyClient,
pparams->cyChar, iLine);
hdc = GetDC(pparams->hwnd);
TextOut(hdc, 0, iLine * pparams->cyChar, szBuffer,
wsprintf(szBuffer, TEXT("%d"), iNum));
ReleaseDC(pparams->hwnd, hdc);
iTemp = iNum;
iNum = iNext;
iNext += iTemp;
iLine++;
}
_endthread();
}
LRESULT APIENTRY WndProc3(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static PARAMS params;
switch (message)
{
case WM_CREATE:
params.hwnd = hwnd;
params.cyChar = HIWORD(GetDialogBaseUnits());
_beginthread(Thread3, 0, ¶ms);
return 0;
case WM_SIZE:
params.cyClient = HIWORD(lParam);
return 0;
case WM_DESTROY:
params.bKill = TRUE;
return 0;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
void Thread4(PVOID pvoid)
{
HDC hdc;
int iDiameter;
PPARAMS pparams;
pparams = (PPARAMS) pvoid;
while (!pparams->bKill)
{
InvalidateRect(pparams->hwnd, NULL, TRUE);
UpdateWindow(pparams->hwnd);
iDiameter = rand() % (max (1,
min(pparams->cxClient, pparams->cyClient)));
hdc = GetDC(pparams->hwnd);
Ellipse(hdc, (pparams->cxClient - iDiameter) / 2,
(pparams->cyClient - iDiameter) / 2,
(pparams->cxClient + iDiameter) / 2,
(pparams->cyClient + iDiameter) / 2);
ReleaseDC(pparams->hwnd, hdc);
}
_endthread();
}
LRESULT APIENTRY WndProc4(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static PARAMS params;
switch (message)
{
case WM_CREATE:
params.hwnd = hwnd;
params.cyChar = HIWORD(GetDialogBaseUnits());
_beginthread(Thread4, 0, ¶ms);
return 0;
case WM_SIZE:
params.cxClient = LOWORD(lParam);
params.cyClient = HIWORD(lParam);
return 0;
case WM_DESTROY:
params.bKill = TRUE;
return 0;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
LRESULT APIENTRY WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static HWND hwndChild[4];
static TCHAR* szChildClass[] = { TEXT("Child1"), TEXT("Child2"),
TEXT("Child3"), TEXT("Child4") };
static WNDPROC ChildProc[] = { WndProc1, WndProc2, WndProc3, WndProc4 };
HINSTANCE hInstance;
int i, cxClient, cyClient;
WNDCLASS wc;
switch (message)
{
case WM_CREATE:
hInstance = (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
for (i = 0; i < 4; i++)
{
wc.lpfnWndProc = ChildProc[i];
wc.lpszClassName = szChildClass[i];
RegisterClass(&wc);
hwndChild[i] = CreateWindow(szChildClass[i], NULL,
WS_CHILDWINDOW | WS_BORDER | WS_VISIBLE,
0, 0, 0, 0,
hwnd, (HMENU) i, hInstance, NULL);
}
return 0;
case WM_SIZE:
cxClient = LOWORD(lParam);
cyClient = HIWORD(lParam);
for (i = 0; i < 4; i++)
MoveWindow(hwndChild[i], (i % 2) * cxClient / 2,
(i > 1) * cyClient / 2,
cxClient / 2, cyClient / 2, TRUE);
return 0;
case WM_CHAR:
if (wParam == '\x1B')
DestroyWindow(hwnd);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
Thanks.
|
|
|
|
|
Look at your thread functions. They are immediately going into loops and doing all sorts of drawing, without ever sleeping. That's why the CPU is being hogged. You should only do drawing in response to a WM_PAINT message.
(Also, use <pre> instead of <code> to make your code more readable on the forum.)
--Mike--
Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Michael Dunn wrote:
Look at your thread functions. They are immediately going into loops and doing all sorts of drawing, without ever sleeping. That's why the CPU is being hogged. You should only do drawing in response to a WM_PAINT message.
Yea, I know but that's the example from Petzold's "Programming Windows" and the code is the same, but he didn't said anything about overheding the system, in fact he wrote that users are in able to move or resize window.
(Sorry, for my bad english )
|
|
|
|
|
Hi All,
I need to develop a password filter, which would enforce minimum password length and other composition rules for the passwords.How do I develop such a password filter.
Can anyone help please?
Thanks,
Abhishek.
Learning is a never ending process of Life.
|
|
|
|
|
You could start by writing a custom Data Validation (DDV) routine to enforce the minimum length, and then your other rules. Take a look at TN026: DDX and DDV Routines[^]
Roger Stewart
"I Owe, I Owe, it's off to work I go..."
|
|
|
|
|
Is it possible to configure the visual studio 6 interface so, that language doesn't matter?
I always get language errors when I want to re-open the resource after transferring the project to another machine. After the error, the resource doesn't load anymore. It says something about french language, but I've never ever installed something regarding a french language, and both win98 are english versions.
Can somebody help me out here?
error msg: Code page 1252 is required to support a french language resource in this file ...
There are absolutely NO french resources in my project, but after compiling the resource, and opening it with a text editor, the resource is filled with loads of french bullshit I've never asked for. So, it's visual studio that adds this by itself. How can I change this???
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
|
|
|
|
|
Open up the project .dsp (or maybe .dsw) You should find a line that sets the language. Something like:
<blanguage=french>
Just delete it. I had this problem with some code from China several years ago. Unfortunately, I don't remember the details.
|
|
|
|
|
Hi,
I place listbox in a small window.The listbox is a child of the window,but
when i move the vscroll bar of the listbox,the wm_vscroll message is not
getting generaterated.
|
|
|
|
|