|
I have a loop that i use to reset checkboxes in a dialogbox.
the setcheck works
the setfont works
but i can not get the settextcolor to work
any input would be appreciated.
for(int i = 0;i < 18;i++){
pButton[i]->SetCheck(false);
pButton[i]->SetFont (&m_checkfont);
pButton[i]->GetDC()->SetTextColor(RGB(255,0,0));
}
|
|
|
|
|
If you want to have captions with specific color, you'll need to use owner-drawn controls. The way you're trying to achieve this effect is totally wrong now - the device context obtained from GetDC isn't used by WM_PAINT handler for checkboxes. Additionally, you have a major GDI resource leak - you're not releasing the context.
Since you apparently have 18 checkboxes, I'd use CListCtrl with LVS_EX_CHECKBOXES extended style. Changing item text color in CListCtrl is easier - CListCtrl::SetTextColor does that.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I'm looking for a tool to convert MSVC RC scripts into HTML, specifically, dialog resources. I have many dialog resources to convert, so I'd rather not do all the work by hand. Any ideas.
|
|
|
|
|
how can i correct this error?
fatal error C1088: Cannot flush compiler intermediate file: 'C:\TEMP\a00202sy': No space left on device
|
|
|
|
|
Isn't the message self-explanatory? Your C: disk is full, try to clean the c:\temp folder.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
...hello,
I have a little problem.
I have a dialog box resource in which i put a Tab Ctrl. Since i need a new Tab Ctrl in the first, under the first, i put another Tab Ctrl.Unfortunetaly this one do not appear at the run-time.
Is anybody has an idea?
Thank for help
R.G
|
|
|
|
|
Hi all,
I tried caching Internet URLs. In that I faced a problem.i.e., After clicking some pages ,Back button helps in getting the Previous pages.But When the Homepage is reloaded , the Back Button should get disabled preventing the Users to go previous pages.
Have any of you come across such problems?? If so , Pls help me Out.
Regards
Maria
maria@sdsindia.com
|
|
|
|
|
I have done gialog based application and now I want to do frame with scrollview, which open when I click a button on my maindialog. I have create a framewindow with its create-funktion and its open but I don't understand how can I set my scrollview within it? I try do it with document template but its need(?) MDI or SDI besed applicatio. Then I try framewindows createview-function but I dont understand how CCreateContext works and its need doctemplate too(?). Actually I want to do some kind of window whitch I can Scroll and I can draw line to it view, a kind of "historydiagram."
I wish you help me,
Tanja
|
|
|
|
|
Hello, I'm writing a client - server application and I have encountered several problems
1) - My server application has to start minimized to tray (no window) and if the user clicks on the tray icon - a popup menu with commands shows - on which you may show the window, etc.
I'm using CSocket to communicate with the server, since it can use archives to transfer(as far as I know you can't do this with CAsyncSocket).
Okay, I can't separate my listen from accept functions - the socket class seem to respond only to OnReceive event. So - it blocks untill it gets connection - after that it's ok. The question here is how to fix that block?
2) - I start my application with SW_HIDE parameter in the CWinApp class - so it has to be invisible, right? But no, after the block, my window shows for a milisecond and hides again. - Any ideas of fixing that?
3) - The UpdateCommandUI on the popup menu (which is not the IDR_MAINFRAME), does not seem to work. Question - why?! (I display it when i receive a notification from the tray icon - WM_RBUTTONDOWN)
4) - It is really strange that my search function for files does not work good also - it works perfect on other apps, but on this one it does not work at all - it eider needs Sleep(250) to work ok - or it stops and locks somehow my sockets.
I will be really thankfull to any WORKING workarounds on theese problems.
Thanks,
Deian
|
|
|
|
|
So - it blocks untill it gets connection - after that it's ok. The question here is how to fix that block? Use a separate thread for your socket communications if you need to respond to UI events while waiting for connections
|
|
|
|
|
Thanks a lot, I will try that.
|
|
|
|
|
Hi:
I´ve create a pointer, don´t mind the type object, and sometime when you want to delete it, this can produce an exception, example when you haven´t initialized the pointer(the error, in this case, will be "Access Violation").How could I catch this error? the problem is that the delete instruction doesn´t catch any exception and doesn´t return any value.
Thanks.
|
|
|
|
|
Always initialize pointer variables to zero, with new or with some other legal pointer value. Use ASSERT_VALID for pointers to MFC objects. Delete will ignore zero pointers so if you take care that any pointer you delete is either zero or points to memory allocated with new you won't have problems. If you want to reuse the pointer variable, zero it after delete.
|
|
|
|
|
I generally use the following macro (the idea originally came from a COM/OLE book 3-4yrs ago):
#define DELETE_POINTER( p ) \
{ \
if( p != NULL ) { \
delete p; \
} \
p = NULL; \
}
So my code is:
fx()
{
CSomeObj pSomeObj = new CSomePbj();
...
DELETE_POINTER( pSomeObj );
}
The macro could easily be updated to include a try,catch block around the delete. If your using MFC you can throw in ASSERT_VALID like the other poster suggested. Or if your not using MFC you can lift the code from the MFC Source to determine if the pointer is valid (validadd.cpp, function AfxIsValidAddress)
Mike
|
|
|
|
|
delete NULL is perfectly valid and does nothing, which is why all pointers should be initialised to NULL, apart from being able to check them for validity. So the above macro only helps if the pointer is NULL, in which case it would do no harm to delete it.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I am writing some test code for a project. I have dozens of messages of a propriety format that I want to display. The messages all take the form of structures where all the data members are public. Rather than manually a control for each element in the structure , is there a way to automatically create a dialog that would display the contents of a specific structure? The only way I can think is to write something to parse the source code . I'd like to be able to drop a control like an ADO data control on a dialog , point it at the structure and let it make a guess of the field types . Then supply an instance at run time for display purposes. Does such a thing exist ?
|
|
|
|
|
Why don't you just add a member function that creates a formatted string containing the structures's data? That way, you only have to write code once and call it when needed.
struct MYSTRUCT
{
int nMyInt;
double dMyDouble;
CString sMyString;
CString GetDataString(CString sVarName)
{
CString sData;
sData.Format("Contents of %s\n"
" nMyInt = %d\n"
" dMyDouble = %lf\n"
" sMyString = %s",
sVarName, nMyInt, dMyDouble, sMyString);
return sData;
};
};
Instead of writing a function that returns a value, you could make the function set an additional value in the struct, but that would make the struct variable use more memory.
struct MYSTRUCT
{
int nMyInt;
double dMyDouble;
CString sMyString;
CString sDataString;
void SetDataString(CString sVarName)
{
sDataString.Format("Contents of %s\n"
" nMyInt = %d\n"
" dMyDouble = %lf\n"
" sMyString = %s",
sVarName, nMyInt, dMyDouble, sMyString);
};
};
At this point, it may be better to write a real live class instead of using a struct, but since I don't know your requirements, that's a call you'll have to make.
Of course, you could just write a global external function to do all that as well.
So many choices, so little time...
|
|
|
|
|
I am using Micrisoft Visual C++ 6.0 compiler in Windows 2000 and I keep getting problems. It sometimes says 'File being used by another process' etc.
Sometimes it even deletes the CPP file when working in the Header. Does anyone know anything about this..
This is causing a lot of probs for me
Thank in advance.
|
|
|
|
|
Hello
How can I get version of MDAC installed on my comp?
Ernst
|
|
|
|
|
file version of "X:\Program files\Common Files\System\ado\msado15.dll"
|
|
|
|
|
I am currently working on a control system application and want to change the priority of the application on starting (dialog based). I could not find any way other than CreateProcess (which is not being used) to change the priority of the process.
Pease guide me with the same (a small example shall be very much helpful).
thanks in advance,
-------------------------------------------
Dashmesh A. Singh
Tata Consultancy Services,
INDIA
e-mail: visions_next@yahoo.co.uk
dashmesha_singh@tcscal.co.in
|
|
|
|
|
|
Thanks Tomasz for your help.
I was able to solve the problem with your help.
//To Set the Priority of the process from within the app
HANDLE hProcess;
DWORD pid;
pid = GetCurrentProcessId();
hProcess = OpenProcess(PROCESS_SET_INFORMATION,true,pid);
if(hProcess == 0)
AfxMessageBox("Invalid Process handle");
else
{
SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS);
CloseHandle(hProcess);
}
-------------------------------------------
Dashmesh A. Singh
Tata Consultancy Services,
INDIA
e-mail: visions_next@yahoo.co.uk
dashmesha_singh@tcscal.co.in
|
|
|
|
|
Hi,
What is parity in modem setting ?
For example in modem setting: 9600,n,8,1
In this setting i don't use of parity, but if i use of it, what will happend ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
When using 7 bit transfers, you have an eighth bit that can be used for a parity check. The sender can set the bit according to whether the number of bits in the data part of the byte is odd or even. This allows a simple sanity check on the receiving side.
Both sides need to agree on the parity setting (high bit signals odd or high bit signals even), or you'll have problems. Typically, a receiver with 8,n,1 will see a senders 7,E,1 data as partial garbage, since it will be getting some chars with 128 added to them, and some without.
|
|
|
|