|
«_Superman_» wrote: Now why would you ever not want UNICODE defined?
well, why not ? lol
seriously, I can't think of a good reason right now, but if it were never useful, why would this compilation mode still exist ?!
anyway, you can never predict what the others will do, so writing a "compiling-at-anytime" code is still prefered...
|
|
|
|
|
Initially I only used ASCII character sets.
A little later I started using the macros (_T, _tcs etc.) with the realization that people could compile this with and without UNICODE defined.
That went on for some years. But I never heard of anyone not defining UNICODE.
So now I only use L"" and the _w versions for the functions.
So probably the terminator will not have the option to not define UNICODE
Just as it is in Windows CE.
«_Superman_»
|
|
|
|
|
Let me try to make the things clear to you (obviously, it is not).
you want the character Omega( Ω ), which is a Unicode character. So if you want to store it in a string, you must allocate a Unicode String.
To do this, you are not obliged to have your whole project building in Unicode (with UNICODE and _UNICODE macros defined).
If you want to have a code that is dependant of the compilation mode (that mean, a code which you don't need to change anything to switch from Unicode to Ansi Build and vice versa), then you should use Generic Text Mappings (_T() macro, and such).
Using CString , _T() and MessageBox() is good most of the time, but here, this is not what you'd want exactly.
As you need a Unicode String, you have to use CStringW , and a literal string written with a prepended L (L"\x03A9" ).
And as MessageBox() gets a CString (and not a CStringW ), you have to adapt the call by using MessageBoxW() instead.
<font color="blue">void</font> main(<font color="blue">void</font>) { <font color="green">
CStringW str = L<font color="gray">"\x03A9"</font>;
MessageBoxW(str);
}
Is that much clear for you now ?
|
|
|
|
|
using code
CStringW str=L"\x0349";
MessageBoxW(str);
complier Gives error that CStringW is undeclared identifier.
|
|
|
|
|
you have to include the correct headers (and make sure you're within a MFC Project)
|
|
|
|
|
Hi...
I am designing a Switch Board Panel using MFC ActiveX Control , in that I want
to add more number of Switch like Gif images .
I am able to add One Particular Gif image more number of times but I actually
want to add different Gif images to that ActiveX Controls......
So Please give me a solution.....
Regards,
Bala
|
|
|
|
|
I created one file suppose "abc.txt". I denied all access to all the users and groups for that file. (I did it by going to Security tab of property dialog of that file.). When I programmatically try to open this file by using API NtOpenFile() with access mask READ_CONTROL in user mode it succeeds. In this case I am opening the file in the user context who is creator owner of that file.
When I try to open the file in the context of other user who is not creator of that file NtOpenFile() fails with error "Access Denied". It may fails due to that user doesn’t have permissions.
Now when I try to open same file in native mode, NtOpenFile() fails with error "Access Denied". What will be the reason? How I can access the file having all permissions denied to all users in native mode?
Can anybody tell who is the user in native mode? Is it System?
|
|
|
|
|
I'm a little confused by the question - the user will be the same one as started the program running, whichever mode you're in.
If your native code is running under your used credentials, it will have your access rights. And as you've set it to "all permissions denied to all users", then not many people can look...
I may have misunderstood, because it looms like you already answered your own question.
Services run under a different user, and drivers run in a different security context again, but that's not what you describe (or what I read!)
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
|
D'oh - I knew that...
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Hi everyone,
I am trying to implement message Queue using ACE framework. Trying to learn that concept from "C++ Network Programming, Volume 2: Systematic Reuse with ACE and Frameworks" book. But not getting head and tail of it.
Could anyone Please give me the important functions/class that will be enough to implement msg queue.
Thank you in advance
I am a learner Always
|
|
|
|
|
|
Hi All,
I am using DeviceIoControl() with control code FSCTL_GET_VOLUME_BITMAP to get the Bitmap of file system.
But the funtion is returning FALSE and GetLastError() is 1 (Incorrect function).
What might be the problem?
code is here:
STARTING_LCN_INPUT_BUFFER StartingLCN;
VOLUME_BITMAP_BUFFER *Bitmap = NULL;
ULONGLONG BitmapSize;
DWORD BytesReturned;
BOOL Result;
StartingLCN.StartingLcn.QuadPart = 0;
BitmapSize = sizeof (VOLUME_BITMAP_BUFFER)*512;
Bitmap = (VOLUME_BITMAP_BUFFER *) malloc (BitmapSize);
Result = DeviceIoControl
(
hHandle,
FSCTL_GET_VOLUME_BITMAP,
&StartingLCN,
sizeof (StartingLCN),
Bitmap,
BitmapSize,
&BytesReturned,
NULL
);
int nError=GetLastError();
if (Result == FALSE && GetLastError () != ERROR_MORE_DATA)
{
free (Bitmap);
return FALSE;
}
|
|
|
|
|
Hai!
In my application there is a dialog containing various controls like 3 buttons, 2 Radio buttons etc.
How can i specify a Tab order for them i.e when i first press Tab on keyboard the 1st button in my dialog must be highlighted, when i again press "Tab" on keyboard 2nd button must be highlighted, How to implement this and how to specify the order?
Thanks!
|
|
|
|
|
open your dialog in the IDE, Press "Ctrl + D". This will display the current tab order. Click on each controls in the order in which you want to set tab-order.
|
|
|
|
|
I did That But the tab order doesn't work on checkbox and RadioButton and i don't know why !!
|
|
|
|
|
|
If you are using resource editor, you can set the tab order there. It is available in "Layout" menu in VC6 and "Format" menu VC9. Shortcut key is Ctrl + D (in VC6 keyboard shortcut map). Then you can see the tab order indication for all controls. You can click on each controls to sequence.
If you are creating the controls dynamically, the creation order sets the tab order. You can change it by using SetWindowPos().
- ns ami -
|
|
|
|
|
Hi ns Ami,
I am creating dynamic edit box in Group Box. My current Tab order is Group Box, OK, Cancel button. Now I want tab order as:
Group box-> Edit Box 1 -> Edit Box 2 -> Edit Box 3 -> OK -> Cancel.
How can i achieve this? do you have any idea?
Regards,
Anshul
|
|
|
|
|
I presume that "dynamic edit box" means you are creating edit box dynamically at run time. If so, you can use SetWindowPos API to set the Z-order of edit control. You will get more information from the API documentation. The parameter hWndInsertAfter (or pWndInsertAfter in the case of MFC) can be the window handle of control, which is needed to be before in tab order.
For example,
m_edit2.SetWindowPos( &m_edit1, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZER | SWP_NOACTIVATE );
This will set the tab order as edit1 -> edit2.
Hope this info will help.
- ns ami -
|
|
|
|
|
Hi Ami,
I am creating edit box in Group box as:
#define ID_CURRENT_SN_EDIT 2000
m_gbGroupBox = (CStatic*)GetDlgItem(IDC_GROUPBOX);
int pointY = 0;
int i = 0;
for (int x = 0; x < m_vecpData->size(); x++, i++)
{
pointY = 30 + (i * 35);
m_ceEdit = new CEdit;
m_ceEdit->Create(WS_VISIBLE| WS_BORDER |ES_READONLY | WS_TABSTOP, CRect(10, pointY, 130, pointY + 25), m_gbGroupBox, ID_CURRENT_SN_EDIT + i);
m_ceEdit->SetWindowText(m_vecpData->at(x).c_str());
m_ceEdit->SetWindowPos(m_gbGroupBox, HWND_BOTTOM , 10, pointY, 130, pointY + 25, SWP_NOSIZE);
m_ceEdit->ShowWindow(SW_SHOWNORMAL);
}
|
|
|
|
|
In this case the tab order will be same as the creation order. So no need to set the Z-order again. Anyway, is this a compilable code? Argument count of SetWindowPos seems as wrong.
Note that you are creating edit control as child of that GroupBox (a static control, i think). In that case the tab key navigation will not enter to the controls inside the GroupBox. Applying WS_EX_CONTROLPARENT style to GroupBox will help you.
For instance,
m_gbGroupBox->ModifyStyleEx( 0, WS_EX_CONTROLPARENT );
- ns ami -
|
|
|
|
|
This is my modified compilable code but tab order is not working as GRPBox -> Edit 1 -> Edit 2 -> Edit 3 -> OK -> CANCEL.
It is still working as GRPBox -> OK -> CANCEL.
#define ID_CURRENT_SN_EDIT 1003
m_gbGroupBox = (CStatic*)GetDlgItem(IDC_GROUPBOX);
m_gbGroupBox->ModifyStyleEx( 0, WS_EX_CONTROLPARENT);
m_btnOK = (CButton*)GetDlgItem(IDC_OK);
m_btnCancel = (CButton*)GetDlgItem(IDC_CANCEL);
int pointY = 0;
int i = 0;
for (int x = 0; x < m_vecpData->size(); x++, i++)
{
pointY = 30 + (i * 35);
m_ceEdit = new CEdit;
m_ceEdit->Create(WS_VISIBLE| WS_BORDER |ES_READONLY, CRect(10, pointY, 130, pointY + 25), m_gbGroupBox, ID_CURRENT_SN_EDIT + i);
m_ceEdit>SetWindowText(m_vecpData->at(x).c_str());
int nCtlrID = ID_CURRENT_SN_EDIT + i;
if (x > 0)
{
CEdit* pEdit = (CEdit*)GetDlgItem(nCtlrID - 1);
m_ceEdit->SetWindowPos(pEdit, 10, pointY, 130, pointY + 25, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE );
}
m_ceEdit->ShowWindow(SW_SHOWNORMAL);
}
Any Help or Suggestion!! I do not know what to do now.
|
|
|
|
|
Well, you missed WS_TABSTOP style.
AJ83 wrote: m_ceEdit->Create(WS_VISIBLE| WS_BORDER |ES_READONLY, CRect(10, pointY, 130, pointY + 25), m_gbGroupBox, ID_CURRENT_SN_EDIT + i);
And the following is not needed...
AJ83 wrote: if (x > 0)
{
CEdit* pEdit = (CEdit*)GetDlgItem(nCtlrID - 1);
m_ceEdit->SetWindowPos(pEdit, 10, pointY, 130, pointY + 25, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE );
}
m_ceEdit->ShowWindow(SW_SHOWNORMAL);
- ns ami -
|
|
|
|
|
Hey Ami,
Thanks a lot for your valuable suggestion. It is working now. great :) !!!
Now my another task is:
There is one Static GRPbox which has been created in CFormView by using ToolBox. Now in Static Groupbox, I am creating "n" number of dynamic GrpBox. In Dynamic GrpBox, I am creating dynamic Edit Box (few are READ ONLY too).
Now I have to set taborder for that also. Any suggestion on this.?
Regards,
Anshul
|
|
|
|
|