|
wrote:
EndDialog(hwnd, 0);
delete tab1_hwnd;
delete tab2_hwnd;
delete tab3_hwnd;
delete tab4_hwnd;
delete tab5_hwnd;
delete tab6_hwnd;
delete CurrentTabHwnd;
delete CurrentTabIndex;
delete hwndTab;
Instead of this try to call the EndDialog(hwnd, 0); after deleting all the tabs.it may resolve your problem
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hey man,
lol thanks for the fix, but I ran into a BIG problem. When I ran the program and closed the dialog box, I got my 8th (i think?) ever BSoD and some very weird exorcist sounds coming from my speakers. So dont think that worked out too well. Any other ides you may have?
Robbie
|
|
|
|
|
I think the problem is because of multiple delete operations performed on the same pointer. You probably believe that a line like
static HWND* tab1_hwnd = new HWND;
within a function allocates the object on each execution of that function. This is not true: the pointer is allocated once.
You can change it like this:
static HWND* tab1_hwnd = NULL;
...
case WM_INITDIALOG:
tab1_hwnd = new HWND;
. . .
case WM_CLOSE:
::DestroyWindow(*tab1_hwnd);
delete tab1_hwnd;
tab1_hwnd = NULL;
. . .
Actually HWND is not so a big object. It takes only 4 bytes. Therefore you can work without pointers:
static HWND tab1_hwnd = NULL;
|
|
|
|
|
Ok thats cool, I'll just take out the pointers since its easier that way. Thanks for your help guys.
|
|
|
|
|
Hi All
I have been puzzelled in a problem,
What have to do is, that I have some file names ( like 000001.doc, programming.doc, etc.) now I have to find out the files that are in hexadecimal (leaving file extension).
Please guide me to find out this
Thanks
|
|
|
|
|
Use isxdigit() on the file's name.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Ahh david's is a much easier way. Its in the following library as well!
#include <ctype.h>
int isxdigit(int c);
|
|
|
|
|
1) Retrieve the file list
2) Loop through each file. For every File name, loop through its name until the extension is reached and check to see if each character is either [0-9] or [A-F]. If its not, just do continue; and start back at the beginning of the loop again. Use this website to utilize the ANSI character set.
http://www.alanwood.net/demos/ansi.html
Remember, the letters can be either lower case or uppercase and have different ANSI codes.
3) Record the file names in an array. (Create a dynamic allocated array for big file names).
Robbie
|
|
|
|
|
Try this idea:
char name[100] = "......." ;
char * p;
strtoul(name, &p, 16);
if( *p == 0)
{
}
else
{
}
Hope it helps.
|
|
|
|
|
I'm trying to in corporate a \n in a CString variable I thought that you could use the format function to do that. Here's the code:
CString look;
look.Format("Original text: <%s>\n"
"Uppered: <%s>\n"
"CompareNoCase says they differ!\n"
"Lowered again: <%s>\n\n"
"Conclusion: CompareNoCase doesn't work correctly!");
AfxMessageBox(look);
But then I keep getting the following errors:
c:\documents and settings\....cpp(102) : error C2664: 'void ATL::CStringT<basetype,stringtraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [137]' to 'const wchar_t *'
with
[
BaseType=wchar_t,
StringTraits=StrTraitMFC_DLL<wchar_t>
]
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Build log was saved at "file://c:\Documents and Settings\kmil\Desktop\tst\LEDs_try2\LEDs_try2\Debug\BuildLog.htm"
LEDs_try2 - 1 error(s), 0 warning(s)
could someone explain to me what i'm doing wrong?
Thanks,
Kitty5
|
|
|
|
|
if you use a parameter in the format of the CString::Format() function, you must provide an additionnal parameter...
CString str;
str.Format("Hello %s...!", "Kitty");
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Instead of:
"Original text: <%s>\n"
"Uppered: <%s>\n"
"CompareNoCase says they differ!\n"
"Lowered again: <%s>\n\n"
"Conclusion: CompareNoCase doesn't work correctly!"
try this:
_T("Original text: <%s>\n")
_T("Uppered: <%s>\n")
_T("CompareNoCase says they differ!\n")
_T("Lowered again: <%s>\n\n")
_T("Conclusion: CompareNoCase doesn't work correctly!")
This is because you are compiling an Unicode application. The _T macro allows you to make programs for both Unicode and ANSI modes.
-- modified at 9:04 Friday 16th June, 2006
|
|
|
|
|
I've tried that... but then I get an "Unhandled exception at 0x102212de (msvcr80d.dll) in LEDs_try2.exe: 0xC0000005: Access violation reading location 0x59199e91..." error. And when you go to debug it opens up the file output.c and points to line 1627 which is:
while (i-- && *pwch)
Kitty5
|
|
|
|
|
i already answered...
you wrote this :
look.Format("Original text: <<font color=red>%s</font>>\n"
"Uppered: <<font color=red>%s</font>>\n"
"CompareNoCase says they differ!\n"
"Lowered again: <<font color=red>%s</font>>\n\n"
"Conclusion: CompareNoCase doesn't work correctly!");
but where are the parameters ?!!!
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
sorry I put up the wrong text...
I don't have any parameters so it's:
look.Format("Original text: \n"
"Uppered: \n"
"CompareNoCase says they differ!\n"
"Lowered again: \n\n"
"Conclusion: CompareNoCase doesn't work correctly!");
Kitty5
-- modified at 9:18 Friday 16th June, 2006
ok yes... i am an idiot... maybe i should get more coffee...
|
|
|
|
|
Look at the answer from toxcct (above).
-- modified at 9:14 Friday 16th June, 2006
Twice, now.
|
|
|
|
|
OK... I am working with an IDispatch -based interface that needs to be completely automation capable (i.e. it uses the Typelib Marshaller - no custom marshalling).
Now, AFAICT:
o I can pass structures over an IDispatch -based interface as the structures consist solely of automation-capable types
o I can pass arrays of automation-capable types over IDispatch -based interfaces using SAFEARRAY (possibly wrapped within a VARIANT )
(For now, ignore the fact that some clients, like VBScript , may be unable to handle these kinds of parameters.)
However, I cannot seem to find information telling me that both are possible at the same time. IOW, I want to pass an array of structures across an IDispatch -based interface. The only information I can find regarding passing arrays of structures indicates that I will have to serialize the data to a byte stream and then send the raw bytes over the wire wrapped in a SAFEARRAY of VT_I1 types.
While I am sure I can make that work, and can provide clients with information on how to decode the structures, this feels kinda 16-bit-ish to me, and not just a little quick-n-dirty.
So, does anyone know if it is possible to pass arrays of structures over IDispatch-based interfaces, or do I have to do the byte-stream route? If so, please point me to the relevant documentation.
Adva[Thanks]nce! (Cheesy, I know... )
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
plz tel me how to change the color of text in a edit control or static control and also tem how to change color of edit control plz tem me some example (code to understabd is easy) plz.....................
Please mail me
-- modified at 8:34 Friday 16th June, 2006
|
|
|
|
|
In OnCtlColor function add this block of code :
Define in the header file as follows in the public section:
COLORREF m_color;
HBRUSH m_brush;
if (pWnd->GetDlgCtrlID () == IDC_EDIT1)
{
pDC->SetBkColor(m_color);
hbr = m_brush;
}
if (pWnd->GetDlgCtrlID () == IDC_EDIT2)
{
pDC->SetBkColor(m_color);
hbr = m_brush;
}
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 8:18 Friday 16th June, 2006
|
|
|
|
|
<br />
HBRUSH CAnswerDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)<br />
{<br />
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
pDC->SetTextColor(RGB(54,97,200));
return hbr;<br />
}<br />
whitesky
|
|
|
|
|
THIS WILL WORK BUT HOW I CAN CHANGE THE COLOR OF EDIT CONTROL AS U TEL BKCOLOR IT WILL CHANGE ONLY TEXT BACKGROUND BUT SIDE OF TEXT DOES NOT CHANGE
Please mail me
|
|
|
|
|
yes see DavidCrow answer its very good and for how to use WM_CTLCOLOREDIT see Here[^]maybe it is some helpful to you
whitesky
|
|
|
|
|
Just respond to the WM_CTLCOLOREDIT message.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
yogendra wrote: plz tel me how to change the color of text in a edit control or static control and also tem how to change color of edit control plz tem me some example (code to understabd is easy) plz.....................
Better way to Subclass both the Controls you can do whatever you want and use those classes.
Following link directs you for subclassing
Extended Edit and Static controls[^]
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hi!
I'm trying to accomplish the following:
A main app having a derived CStatic class called CPauseAdm.
A regular MFC DLL having a derived CPauseAdm class called CPauseTestAdm.
I want to make a form of plugin system where the CPauseTestAdm can be used instead of CPauseAdm without being forced to recompile the main app.
So far, I have been able to contruct the CPauseTestAdm class in my main app and call a number of its member functions. But when I try to create the window of CPauseTestAdm the Create function always return 0 and I get just a hwnd=NULL. Could somebody tell me what I'm doing wrong ?
BTW. The CPauseTestAdm object is created by the DLL through a wrapper function. I have tried to create it's window in both the main app and through a wrapper function exported by the DLL but none of these methods worked. Create returns 0 either way...
|
|
|
|