|
a file named Wum.htm - please note, only first character of the file name is upcase (viewed in Windows file explorer).
when I use CFileFind or FindFirstFile to search the file, GetFileName() or GetFilePath() displays the file name as WUM.HTM - please note, all of characters of the file name are upcase.
as test:
1) if I copy it in Windows file explorer manually, the copy name is "Copy of WUM.HTM", the file name is still upcase.
2) if I change the file name to um.htm then back to Wum.htm - CFileFind gets same cases as viewd in Windows file explorer: Wum.htm.
I need case sensitive in CFileFind (related to UNIX issues) to search file names, could you explain why for above problem and how to solve it?
thx
you can find the file (Wum.htm) in your computer because it is a Windows file and test it if you like.
includeh10
|
|
|
|
|
I have had this problem several times and usually I just find another way to do what I want or don't do it at all, but I would really like to know how to fix this if anyone knows.
I have a label with some text that I created at design time and then I make it invisible. Then I call ShowWindow(SW_SHOW) just prior to going into a print function which uses WriteFile to print to the parallel or serial ports. But the label does not show up. If I put in a MessageBox() to pause the program, it does show up. Does anyone know how to fix this problem?
Roger
|
|
|
|
|
The problem has to do with the fact that Windows hasn't told the label to repaint itself until after the blocking WriteFile() call has completed. Try this:
m_label.SetWindowText ("foo");
m_label.Invalidate();
m_label.UpdateWindow();
WriteFile (...);
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Thanks alot, that was just what I was looking for.
Roger
|
|
|
|
|
Hi,
I have created a ComboBox using DLGITEMTEMPLATE * and now, I want to add entries to this combobox. I could not have managed to figure out how to do this.
Could nay body please help me out.
Regards,
ATif Gul
|
|
|
|
|
|
hi douglas,
Thanks a lot for sending me the link. I tried to send message to the combobox but it is not working. Let me explainn the problem a bit more.
I have a DLGTEMPLATE * dialog, using this structure I create a dialog. then I use CreateIndirect of CDialog to create this dialog in memory.
I add different controls to this dialog and each control is DLGITEMTEMPLATE *. I create a DLGTEMPLATEITEM* combobox and create it in memory. Now, when I do CWnD::GetDlgItem(IDC_COMBOBOX) it returns NULL. Could you please tell me what I am doing wrong or what the problem is.
I tried the following code
HWND combo_box_handle = 0;
combo_box_handle = GetDlgItem(COMBOBOX_ID);
SendMessage(combo_box_handle, CB_ADDSTRING, 0,(LPARAM)"One");
Thanks and regards,
Atif Gul Hashmi
|
|
|
|
|
Your code to add the string is correct, however if you are adding items to your memory template after you have called CreateDialogIndirect, the new items will not be part of the dialog until you first close that dialog window and recall CreateDialogIndirect.
The only way to add more control items to an existing dialog would be to use CreateWindow and specify the dialog as the hwnd parent.
|
|
|
|
|
I am not sure if I quite understood what you are saying. Actaully I create the dialog using CreataIndirect which is the member of CDialog class. Secondly, the combobox that I created using the DLGITEMTEMPLATE * is displayed when I run the program but when I use GetDlgItem(IDC_COMBO) it returns NULL as if the combobox does not exits.
So could you please tell me how can I add items to this combobox.
Regards,
Atif
|
|
|
|
|
Atif, I sugguest you debug the program in conjunction with Spy++ and verify the combo box identifier. If the combox box is being displayed in the dialog then it will have a window handle and items can be added. With GetDlgItem returning null then either your IDC_ is incorrect or the window handle for the dialog is incorrect.
|
|
|
|
|
I am writing a program for the filtering. I have set 7 radio buttons (their value in order is false, and true - as the index represents 0 and 1 respectively) on the left side, and for the right side, would be the 6 boolean Logic combo boxes with values of "AND", and "OR").
I have a problem and am trying to determine on how I get the program to recognize the boolean logic box as a logic boolean.
for example, for the left side, 1st top two radio would have in order, true and false.
on the right side, for the logic, I would set it to AND.
Then I push the test button to run the boolean test and get the output result of red/green on the panel.
The thing is that I'm trying to get the program to "see" the combobox as logic boolean. Can anyone help?
<sorry about="" leaving="" out="" photo...="">
The photo is uploaded to my website:
http://www.geocities.com/livfalls/LogicTest.jpg[^]
-- modified at 8:00 Tuesday 8th November, 2005
|
|
|
|
|
I guess if you have a drop down that says AND and OR, you need to check what the selected value is, and work accordingly.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
This is why I wish we could post images of what we are talking about, if I could see it I might under stand it. Your wording sounds like a legal document, written by some lawyer, you know it says some thing, but you cann't quite understand it.
Break out a pincel and paper, try to draw it out and write down what it is supposed to do in the simpilist terms you can. If you do that you may not need to repost, because you'll know the answer. If you don't, post your what your wrote or provide some pseudo code.
INTP
Every thing is relative...
|
|
|
|
|
I have figured out this problem...
What I did was to combine the digits for the boolean logic (right side as seen on the photo).
from top down into 6 digit int value (into array). I then convert this digit into an single int value using atoi, then use switch case to determine where it matches. I know this is the hard way and the code for switch case is very LONG!
Like this snipped example below:
//**********************************//
//***** note for case below: *****//
//***** 0 = N/A *****//
//***** 1 = && *****//
//***** 2 = || *****//
//**********************************//
switch (logicDecValue)
{
case 000000: LogicResult = crit1; break;
case 100000: LogicResult = crit1 && crit2; break;
case 200000: LogicResult = crit1 || crit2; break;
case 110000: LogicResult = crit1 && crit2 && crit3; break;
case 210000: LogicResult = crit1 || crit2 && crit3; break;
case 120000: LogicResult = crit1 && crit2 || crit3; break;
case 220000: LogicResult = crit1 || crit2 || crit3; break;
case 111000: LogicResult = crit1 && crit2 && crit3 && crit4; break;
case 112000: LogicResult = crit1 && crit2 && crit3 || crit4; break;
case 121000: LogicResult = crit1 && crit2 || crit3 && crit4; break;
case 122000: LogicResult = crit1 && crit2 || crit3 || crit4; break;
case 211000: LogicResult = crit1 || crit2 && crit3 && crit4; break;
case 212000: LogicResult = crit1 || crit2 && crit3 || crit4; break;
default: LogicResult = false;
}
That's what I do for now.
|
|
|
|
|
Greetings:
I have numerous dialog boxes and property pages containing, among other things, CEditCtrl boxes. I have found that whenever I make an entry into the Edit Control and press ENTER (an instinctive response), the entire dialog or propery sheet closes!
I can't figure out how to prevent this. I would like to make it so that, when you press ENTER in one of these boxes, it either:
1. Accepts and processes the input and stays in the edit box
2. Accepts and processes the input and moves to the next control in the TAB order.
Any suggestions?
Thanks in advance!
Mark
-- modified at 14:47 Monday 7th November, 2005
|
|
|
|
|
Look here[^] and search for question:
MFC questions - > 7.4 How do I prevent a dialog from closing when the user presses Enter or Esc?
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
Hi Giorgi:
Thanks for your response.
It is working for my regular dialog boxes but it is not working for my property sheets. I do not know which function I should override. I have tried overriding OnOK, OnApply and OnCancel, but when I place a break point in my overrides, they are not called when I press ENTER.
Any ideas?
Thanks again,
Mark
|
|
|
|
|
The same thing happens when filling out edit fields on a Web page, your customers should be used to it.
Given that, try selecting the style "Want return" in the edit controls properties->Styles tab. Naturaly this works for multi-line edit controls, but I do not know about single-line edit controls.
INTP
Every thing is relative...
|
|
|
|
|
Hi John:
Yes, I did already try the "Want Return" option. All of my edit controls are single line and I can confirm that it had no effect.
Mark
|
|
|
|
|
Ya, I thought that might be the case. I find it a bit irritating myself, but it is normal behaviour for single-line edit controls, in a dialog box or on a Web page.
I do not beleave there is general method for accomplishing what you are trying to do.
You could subclass the edit controls and intercept the key strokes. That way you could negate the ones you don't want to be processed. You need to check if you want OnKeyDown() or OnChar(), I forget which you need (research). The problem with subclassing: (1) You have to generate (or manualy create) the subclass, and (2) remember to use it when ever you want that functionality.
That was a mouth full, and just touchs on what I am thinking.
What was recomended in the FAQ (as recommeded by someone else) is a good start, but it would include all controls (not just edit controls). But, here is a thouht, if you know what control you where in when ENTER was press (its ID) then you check the ID to see how to act in the OnOk() or OnCancel() functions.
P.S. This is a flaw that is every where (dialog boxes, the Web, etc...), we can stop it in the programs we write (w/a little effort), but all that will server to do: is futhur the confusion. Example: Enter address in you browser and press enter, and we go there (as expected). Enter something in a Web page or dialog box and hit enter, unless it is a multi-line edit box, we (have been programed to) expect something to happen. I know it's confusing a irritating, but we have to learn to accept it.
INTP
Every thing is relative...
|
|
|
|
|
Hello,
I'm writing sort of secure application for keystroke input.
I want to make it hidden to existing key-logger systems.
I made "anti-hook" Application - but then figured out that some of the keyLoggers, like:
http://www.amplusnet.com/products/stealthkeylogger/overview.htm
But this one doesn't see the Window's one VirtualKeyboard
I have no clue how implement that. have any one clue how to do that?
|
|
|
|
|
It is a matter of who is at the head of the list. Normaly I would ignore this type of question because someone is probably doing something they should not.
The last one to hook, is the first one to get any information that is sent. So if you think that they have hooked the program when it started then put in a delay and intiate your hook latter.
P.S. Years ago I was walking around the cubicals (on third shift) and saw a print out that showed every key storke I had made the night before, so I can understande why you would want to know this. The fact that I was doing my job and nothing more is irrelivent, I hate being spyed upone.
INTP
Every thing is relative...
|
|
|
|
|
How do I get mouse keyboard and the blinking caret ready for user input, just like when you open up Microsoft Word? Trying to build a customized word processor and I am having trouble finding the basics. I already have an MDI built using the MFC Application Wizard. When I compile the program, the child window has no way to accept any input from the user in the document area. Do I need to add a richTextBox to the child window or what? Sorry for the dumb question but need some basic direction on how to do this in Visual C++.net
Thanks so much...
RRL
|
|
|
|
|
sveige wrote: Do I need to add a richTextBox to the child window or what?
No! Unless you are writing a wrapper around somebody elses code. Like every body else does, and I don't blame them as they have to make a livening (like us).
NOTE: If it is handed to you, then work with it.
I am ass-u-me(ing) that you (like me) wants to know how to do it.
Pop me an e-mail, and we'll discuse it.
INTP
Every thing is relative...
|
|
|
|
|
Hello all,
I have a program that reads a IIS log and then parses every line and puts that info into a structure.. I later use this info to disply different items of value. The following code is used in a Win UI Thread.. This works fine but its SUPER Slow.. Can anyone help me speed this up? I thought about parsing the file line by line as I read it in but I don't see any line by line options in CFile.
Any suggestions are welcome..
<code>
static char BASED_CODE szFilter[] = _T("Log Files (*.log)|*.log||");
CFileDialog m_ldFile(TRUE,_T(".log"),_T(""),OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter);
if (m_ldFile.DoModal() == IDOK)
{
::PostMessage(m_pMainWnd->GetSafeHwnd(), UWM_PT_START, 0,0);
CString strFilePath = m_ldFile.GetPathName(),
strData = _T("");
CFile file;
if(file.Open(strFilePath, CFile::modeRead | CFile::shareDenyNone))
{
char cBuf[65536];
UINT uBytesRead;
while(uBytesRead = file.Read(cBuf, sizeof(cBuf)-1))
{
cBuf[uBytesRead] = NULL;
strData += CString(cBuf);
}
file.Close();
strData.MakeLower();
int nHeaderStart = 0,
nHeaderEnd = 0,
nEndLine = 0;
nHeaderStart = strData.Find(_T("#fields: "),0);
nHeaderEnd = strData.Find(_T("\r\n"), nHeaderStart);
if(strData.GetLength() >= (nHeaderEnd +2))
strData.Delete(0, nHeaderEnd +2);
else
strData.Empty();
v_items.erase(v_items.begin(), v_items.end());
while(!strData.IsEmpty())
{
nEndLine = strData.Find(_T("\r\n"), 0);
if(nEndLine > 0)
{
CString strLine = strData.Mid(0, nEndLine);
int nToken = 0;
s_item pItem;
nToken = strLine.Find(_T(" "), 0);
pItem.sDate = strLine.Mid(0, nToken);
strLine.Delete(0, nToken +1);
nToken = strLine.Find(_T(" "), 0);
pItem.sTime = strLine.Mid(0, nToken);
strLine.Delete(0, nToken +1);
nToken = strLine.Find(_T(" "), 0);
pItem.sIPServer = strLine.Mid(0, nToken);
strLine.Delete(0, nToken +1);
nToken = strLine.Find(_T(" "), 0);
pItem.sMethod = strLine.Mid(0, nToken);
strLine.Delete(0, nToken +1);
nToken = strLine.Find(_T(" "), 0);
pItem.sURIStem = strLine.Mid(0, nToken);
strLine.Delete(0, nToken +1);
nToken = strLine.Find(_T(" "), 0);
pItem.sURIQuery = strLine.Mid(0, nToken);
strLine.Delete(0, nToken +1);
nToken = strLine.Find(_T(" "), 0);
pItem.sPort = strLine.Mid(0, nToken);
strLine.Delete(0, nToken +1);
nToken = strLine.Find(_T(" "), 0);
pItem.sUsername = strLine.Mid(0, nToken);
strLine.Delete(0, nToken +1);
nToken = strLine.Find(_T(" "), 0);
pItem.sIPClient = strLine.Mid(0, nToken);
strLine.Delete(0, nToken +1);
nToken = strLine.Find(_T(" "), 0);
pItem.sUserAgent = strLine.Mid(0, nToken);
strLine.Delete(0, nToken +1);
nToken = strLine.Find(_T(" "), 0);
pItem.sStatus = strLine.Mid(0, nToken);
strLine.Delete(0, nToken +1);
nToken = strLine.Find(_T(" "), 0);
pItem.sSubstatus = strLine.Mid(0, nToken);
strLine.Delete(0, nToken +1);
pItem.sWin32Status = strLine;
strLine.Empty();
v_items.push_back(pItem);
if(strData.GetLength() > (nEndLine +2))
strData.Delete(0, nEndLine +2);
else
strData.Empty();
}
else
strData.Empty();
}
}
}
</code>
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|