|
Put your strings into a stringtable.
|
|
|
|
|
That's what how to put it into string table and then how to display it from EXE?
|
|
|
|
|
Create a resource file (.rc) and add your string(s) to the stringtable. Then you can simply load the strings with LoadString() or CString::LoadString() if you are using MFC.
|
|
|
|
|
Isn't there a string table which is automatically made?
How to retrieve from that string table?
|
|
|
|
|
Are you the same person as the thread starter? Or do you just have the exact same problem?
Anyway, it very much depends on how you created your application. If you used a Visual Studio wizard then you will possibly already have a resource script included in your project, depending on which app type you chose.
If not - and you are using Visual Studio - it's very simple to add resources to your project. Look at the documentation.
|
|
|
|
|
Hi
How to established connection in mysql without ODBC?
Plz help me
|
|
|
|
|
Hi all,
i want to use Menu on right click of ListCtrl,
i m using this code
void CTest::OnNMRClickList(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMITEMACTIVATE pia = (LPNMITEMACTIVATE)pNMHDR;
UINT flags;
DWORD pos = GetMessagePos();
CPoint point(LOWORD(pos), HIWORD(pos));
m_List.ScreenToClient(&point);
int nItem = m_List.HitTest(point, &flags);
HMENU hMenu = ::CreatePopupMenu();
if (NULL != hMenu)
{
::AppendMenu(hMenu, MF_STRING, 1, "Test1");
::AppendMenu(hMenu, MF_SEPARATOR,2, "");
::AppendMenu(hMenu, MF_STRING, 3, "Test2");
::AppendMenu(hMenu, MF_SEPARATOR,4, "");
::AppendMenu(hMenu, MF_STRING, 5, "Test3");
ClientToScreen(&point);
int sel = ::TrackPopupMenuEx(hMenu,TPM_LEFTALIGN|TPM_RETURNCMD,point.x,point.y,m_hWnd,NULL);
switch(sel)
{
case 1:
{
}
break;
case 3:
{
}
break;
case 5:
{
}
break;
}
}
*pResult = 0;
}
its working fine only one problem is here its not popup the menu on tip of mouse cursor.
please tell me where i m wrong.
please help me .
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
"_$h@nky_" wrote: DWORD pos = GetMessagePos();
CPoint point(LOWORD(pos), HIWORD(pos));
m_List.ScreenToClient(&point);
I think perhaps this is where your problem lies. The list box returns the cursor position in the LPNMITEMACTIVATE structure. You will need to convert this position to its absolute screenvalues via
ClientToScreen(hWnd, &pia->ptAction);
and then use pia->ptAction.x and pia->ptAction.y in your call to TrackPopupMenuEx().
|
|
|
|
|
No its not working
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
What is not working? What have you tried, and what results do you see?
|
|
|
|
|
Now i m using like this
UINT flags;
DWORD pos = GetMessagePos();
CPoint point(LOWORD(pos), HIWORD(pos));
m_List.ScreenToClient(&point);
int nItem = m_List.HitTest(point, &flags);
HMENU hMenu = ::CreatePopupMenu();
if (NULL != hMenu)
{
::AppendMenu(hMenu, MF_STRING, 1, "Test1");
::AppendMenu(hMenu, MF_SEPARATOR,2, "");
::AppendMenu(hMenu, MF_STRING, 3, "Test2");
::AppendMenu(hMenu, MF_SEPARATOR,4, "");
::AppendMenu(hMenu, MF_STRING, 5, "Test3");
ClientToScreen(&pia->ptAction);
int sel = ::TrackPopupMenuEx(hMenu,TPM_LEFTALIGN|TPM_RETURNCMD,pia->ptAction.x,pia->ptAction.y,m_hWnd,NULL);
switch(sel)
{
case 1:
{
}
break;
case 3:
{
}
break;
case 5:
{
}
break;
}
}
but still when i right click on ListCtrl the menu not popup from tip of mouse cursor.
please help me.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
This looks correct now, so I am at a loss to understand why it does not poup at the correct location. Where does it appear on your system relative to the screen? You may also like to use the debugger to check the values of x and y before and after the ClientToScreen(&pia->ptAction); call.
|
|
|
|
|
Thanks its done now.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
How I will write a macro to check that weather the pointer is NULL or not and if NOT then delete it.
Ex;
CXyz * abcd = new CXyz();
// do some thing with *abcd
if (abcd != Null)
{
delete abcd;
abcd = NULL:
}
I have to write a macro so as not to write the code again
Or shall I write a function for the same but then what will be its prototype
Please tell me how and where to write the code for it.
|
|
|
|
|
That's even more simple than that: you don't even need to check if the pointer is NULL or not, the delete operator takes care of that. So, if you pass a NULL pointer to delete, nothing happens.
EDIT: BTW, no need to repost your question so quickly, this is a forum here, not a chat...
|
|
|
|
|
Does delete operator checks for NULL itself?
Well I have to assign NULL after deleting also.
How I will define it
#define DELETE(ptr)
Is this declareation of macro is correct?
If yes then whhere I Will write its functionality
|
|
|
|
|
Honnestly, I would advise you not to write a macro for this. In general, using macro (in this particular case) makes the code harder to read. Here, it doesn't really have any additional value (except that you don't have to type the assignment).
Anyway, if you really want to do something like that, the macro would be:
#define DELETE(ptr) delete ptr; ptr = NULL;
|
|
|
|
|
Thanks a lot.
But why should not write a macro in this case,well I have read on Net also that we should not write a Macro for deleting.But I did'nt come accros any good reason.Will you please provide me one.
|
|
|
|
|
Because macros can have unforeseen consequences - consider this:
#define DELETE(ptr) delete ptr; ptr = NULL;
if (myPtr->DeleteMe()) DELETE(myPtr);
That's translated by the pre-processor to
if (myPtr->DeleteMe()) delete myPtr; myPtr = NULL;;
So myPtr will be set to NULL even if it shouldn't be deleted...
There are ways around that, but I'd rather write this:
template<class _Ty>
inline void Delete(_Ty*& ptr)
{
delete ptr;
ptr = 0;
}
because it's not messing around with the program text - it doesn't rely on pre-processor magic.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
like this?
#define MyDelete(_ptr) if (_ptr) {delete _ptr; _ptr=NULL;}
|
|
|
|
|
hi guys i and bard...i want to do a braille programming using visual C++..
firstly...the key that input was S,D,F,J,K,L...how can i set the input from keyboard...
example like> if i push the input from keyboard letter SDF is for image 1, S for image 2,SDFJKL for image 3 or etc...
example>the sentences was
'saya suka makan'
s=image 1
a=image 2
y=image 3
a=image 1
s=image1
u=image 4
k=image 5
a=image 2
m=image7
a=image 2
k=image 5
a=image 2
n=image 8
display look like,
image 1,image2,image3,image1 ,image 0,image1,image 4,image5,image6,image0,image7,image2,image5,image2,image8
*image 0 for the space.
i wanted to put just 20 image on row...every time finish, i can reset the image...
please guys help me! email me..hightemperature@yahoo.com
|
|
|
|
|
mr bard2 wrote: i want to do a braille programming using visual C++..
As far as I know, Braille is for blind people. So, replacing the text with images won't solve anything.
Anyway, your question is really vague because we don't know anything of your project: are you using MFC ? Where do you want to display those figures ? Directly on the dialog, in a specific control, ... ?
|
|
|
|
|
i wanted the display on the screen like this...
http://lookpic.com/i/990/Q8s8GvYz.jpeg
could every help me...please...
|
|
|
|
|
Are you wanting to paint bitmaps onto the screen or will the program create the image dynamically? If the former then just use the BitMap functions to load and display each image on the screen as required. If the latter then there will be some more code required to calculate where to paint your dots. In either case there are many tutorials on CP about displaying/creating images to the screen.
|
|
|
|
|
Hello all..
I'm making an application which terminate other processes in different way, i.e using TerminateProcess, WM_CLOSE, WM_QUIT, SC_CLOSE.
Now i'm able to terminate process in all the way, But i need bit explanation in WM_CLOSE, WM_QUIT and SC_CLOSE.. How exactly it closes other process?? I believe there are two conditions which need to be fulfilled.
1> The target process has at least one window.
2> The target process doesn't handle the WM_CLOSE, WM_QUIT, SC_CLOSE message.
So i'm doing this to enumerates all top level windows, In LPARAM i'm passing the pid of the target process..
EnumWindows((WNDENUMPROC)Enum_Terminate_Process, (LPARAM) aiPID[i]);
And in Enum_Terminate_Process, I'm doing something like this..
BOOL CALLBACK Enum_Terminate_Process(HWND hWnd, LPARAM lParam)
{
DWORD dwID;
GetWindowThreadProcessId(hWnd, &dwID);
if(dwID == (DWORD)lParam)
{
char Title[MAX_PATH];
Title[0] = 0;
GetWindowText(hWnd, Title, sizeof(Title));
if(IsWindowEnabled(hWnd) && Title[0]!= 0 && Proc_Argument[0]!= 0)
{
if(strcmp(Proc_Argument , "-wmc") == 0)
SendMessage(hWnd, WM_CLOSE, 0, 0 );
else if(strcmp(Proc_Argument , "-wmq") == 0)
PostMessage(hWnd, WM_QUIT, 0, 0);
else if(strcmp(Proc_Argument, "-scl") == 0)
PostMessage(hWnd, WM_SYSCOMMAND,SC_CLOSE,0);
else
MessageBox(NULL,"Invalid Arguments", "Error", MB_OK);
}
}
return TRUE;
}
So i need to know whether i'm doing right?
Thanks All..
modified on Monday, September 7, 2009 4:39 AM
|
|
|
|
|