|
|
Excellant that is what I needed!!!
Thanks for your help!!!
|
|
|
|
|
Hello all,
Here is my final solution to my original question:
// Create an auto check box.
m_blah4.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_PUSHLIKE|BS_AUTOCHECKBOX, CRect(10,100,100,130), this, MY_BTN4);
Now the button works like the push button check box in the resource.
Thanks to all of you who helped me!!
|
|
|
|
|
When I do
CSocket sock;
sock.Connect(place_that_doesn't_exist);
Connect waits like half a minute before returning. I could do some kind of multithreading or overlapped IO completion ports (neither of which I have any experience with) but it would work for me just to have it return after a second or two if it can't connect. I was thinking along the lines of something like
sock.SetTimeout(500_milliseconds);
or
setsockopt(sock.m_socket, SO_TIMEOUT, 500_milliseconds);
Any suggestions? Thanks!
- Alex Griffing
|
|
|
|
|
I am having trouble with overriding CWndClassInfo in ATL/WTL. I am working to set the cursor for a CListViewCtrl derived class (ListCtrl) to be a cross (IDC_CROSS) and remove the CS_HREDRAW & CS_VREDRAW to eliminate the flicker during resizing (Q183210). I thought I made the appropriate changes (see below) yet the view does not display the cross cursor and the flicker is still present. What else is needed to invoke the ListCtrl::GetWndClassInfo()? Are there examples of what I am trying to do in ATL?
// ListCtrl.h
class ListCtrl : public CWindowImpl<listctrl, clistviewctrl="">
{
public:
ListCtrl();
virtual ~ListCtrl();
BEGIN_MSG_MAP(ListCtrl)
MESSAGE_HANDLER(WM_PAINT, OnPaint)
END_MSG_MAP()
public:
LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/,
BOOL& /*bHandled*/);
static CWndClassInfo& GetWndClassInfo()
{
static CWndClassInfo wc = {
{
sizeof(WNDCLASSEX),
0,
StartWindowProc,
0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW+1), NULL,
_T("ListCtrl"), NULL
},
NULL, NULL, IDC_CROSS, TRUE, 0, _T("")
};
return wc;
};
};
// Status.cpp
Status::Status()
{
list_view = new ListCtrl;
}
Status::~Status()
{
if (list_view)
delete list_view;
}
HRESULT Status::open(const HWND hWnd)
{
if (list_view) {
RECT rect;
::GetClientRect(hWnd, &rect);
HWND h = list_view->Create(hWnd, rect, _T("ListCtrl"),
WS_CHILD |
WS_VISIBLE |
WS_CLIPSIBLINGS |
WS_CLIPCHILDREN |
LVS_REPORT,
WS_EX_CLIENTEDGE);
return S_OK;
}
|
|
|
|
|
How can I access the information about my display? I want to get the HxW pixel settings (i.e. 2048x768) so that I can place my dialogs on the screen (desktop) with minimal overlap.
Also, I have a dual monitor setup and my users may/may not have the same - would this matter in the information retrieved?
Ad-THANKS-vance
Johnny
|
|
|
|
|
I just can tell you how to get the witdh and height of your screen:
int width = GetSystemMetrics(SM_CXSCREEN);
int height = GetSystemMetrics(SM_CYSCREEN);
regards
|
|
|
|
|
How I can disable the item in list control.
Thanks!
|
|
|
|
|
Hello, the codegurus around the world.;)
I don't understand cleary what means "disable the item".
But, I guess that you want to make the mouse click on some itme on the list disable?
Maybe, after you subclass CMyListCtrl, and create struct value like ItemProperties,
and keep the record of which index item will be disabled (kill the mouse clicking).
If you disable one all row, colum or one special cell, these are different stories and
you need more codes to do these.
You also add the code to show how this item is disable, and must redraw the index disabled.
But, this kind of the code seems to be very interesting.
If someone creates this kind of the control, please post your new class to Codeproject.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Hi
I want to create a window that will stay on top of the screen. It should be as width as the screen and as height as the taskbar (may have a constant height). The user shouldn't be able to move the bar.
How should I start? Do I need to create deskband, or does a simple dialog based app teh same job?
Any suggestions or links are greatly appreciated
|
|
|
|
|
What you want is an app bar. Look up "application desktop toolbars" in MSDN.
--Mike--
http://home.inreach.com/mdunn/
"Listen you footwarriors, can you hold down a bit with the firing? I've just got three impromptu weddings breaking out behind me!" -- Arthur Dent
your with and
|
|
|
|
|
A dialog based app will work. Just use a CDialog without a caption bar.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
|
I am looking for a way to use the TRACE macros without adding MFC to my project. Does anyone have macro definitions to do this?
But if you do wrong, be afraid, for [the one in authority] does not bear the sword for nothing. He is God's servant, an agent of Wrath to bring punishment to the wrongdoer -- Romans 13:4
|
|
|
|
|
void RDTrace(const char* fmt, ...)
{
#ifdef _DEBUG
char buffer[1024];
va_list argptr;
va_start(argptr, fmt);
_vsnprintf(buffer, 1024, fmt, argptr);
va_end(argptr);
OutputDebugString(buffer);
#endif
}
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Thanks Chris, I just about got this far, but where is the OutputDebugString function declared?
I'm currently using <fstream> to dump my TRACE output to a file, but I would prefer it to come into the IDE so I can see it while it runs.
But if you do wrong, be afraid, for [the one in authority] does not bear the sword for nothing. He is God's servant, an agent of Wrath to bring punishment to the wrongdoer -- Romans 13:4
|
|
|
|
|
OutputDebugString is a Win32 API function. #include Windows.h to get it. (it's actually in winbase.h).
it's what TRACE ends up calling. ODS will even dump stuff in release mode, hence the #ifdef _DEBUG.
you can even use the lovely WinDBG32 app to capture these message outside of the IDE.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Thanks, I gave it a try and it worked. This is the first time I've actually had a question. It's great the speed with which this community answers questions.
But if you do wrong, be afraid, for [the one in authority] does not bear the sword for nothing. He is God's servant, an agent of Wrath to bring punishment to the wrongdoer -- Romans 13:4
|
|
|
|
|
You can just grab the code for AfxTrace() from the MFC\src directory and copy it to your program, too. There's also ATLTRACE if you are using ATL.
--Mike--
http://home.inreach.com/mdunn/
"Listen you footwarriors, can you hold down a bit with the firing? I've just got three impromptu weddings breaking out behind me!" -- Arthur Dent
your with and
|
|
|
|
|
When I set a WH_MOUSE hook,how can I get the class of the control which was clicked by leftmouse?
|
|
|
|
|
If you have mouse coordinates, try with WindowFromPoint() and ChildWindowFromPoint(), then use GetClassName() to know which control it is.
Hope this helps,
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Hi !
Before use any command from NetApi32.DLL ( NetAPIFreeBuffer and all that stuff), I check if the version is not 95/98, .... but anyway if I try to run the EXE in a machine with 95/98 it gives me an error ( I think when tries to load the DLL or... ? I´m not sure).
Is there anyway to avoid that ? ( If I can run the program in 98 the specific NT functions never will be executed, because of the checking...).
Thanks, Bye !
Braulio
|
|
|
|
|
Use DelayLoad feature or explicitly call LoadLibrary/GetProcAddress.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
|
Hi,
I've experienced the strangest behaviour of my VS 6.0. I have project with multiple, hierarchially dependent sub-projects (each one comprising a dll). I added some code to a header file of the most basic sub-project and compiled it. The compilation went fine, VS went into linking, I heard a beep and the compilation froze! I tried to shut down VS but was told that I had to stop the compilation first, but stopping it from the menu or the button didn't have any effect. I eventually had to cold-boot my Win95 system. I removed the coded I had added, and it went fine. I added it again and compilation went fine. I made some other (very small) changes, it crashed on compilation again!
Does this ring a bell for anybody? Any suggestions?
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|