|
I guess the macro should be modified as follows
#define __TOREPLACE__ "replaced"
and used like
"path/subpath/"__TOREPLACE__
"path\"__TOREPLACE__"image.png"
|
|
|
|
|
thanks Naveen, but unfortunately,
the result is not what i wanted.
"path/subpath/""replaced"
"path\"__TOREPLACE__"image.png"
|
|
|
|
|
tarcairion wrote: "path\"__TOREPLACE__"image.png"
you should put double slashes...
"path\\"__TOREPLACE__"image.png"
|
|
|
|
|
The C pre-processor is seeing __TOREPLACE__image.png as a single identifier. That identifier isn't __TOREPLACE__ , so it doesn't replace it.
If you want to 'glue' a replaced value to some static text, you'll need something like this:
#define GLUE2(A, B) A##B
#define GLUE(A, B) GLUE2(A,B)
#define __TOREPLACE__ replaced
path/subpath/__TOREPLACE__
GLUE(path\,GLUE(__TOREPLACE__,image.png))
That works OK under the VC++ pre-processor, giving this output:
path/subpath/replaced
path\replacedimage.png
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
thank you for your answer, Stuart. this works, indeed.
i seems to be that the preprocessor has some difficulty
to identify a #define in some places due to missing
delimiters
but as you stated it may not be the best approach, so
i will try something else like you mentioned.
|
|
|
|
|
Hi there.
We have some stored procedures on a remote SQL Server.
Now, from my local machine using C++ I want to call a stored procedure.
Please provide sample code if available for the same.
Incase any further information required, please let me know.
Thanks and Regards
PanB
|
|
|
|
|
Let's me try to use Google for you...^
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi all,
I have made a dialog based application in vc-2008. I have made 2 more dialog boxes...
Now what i have to do is on button click event 1st dialog box is called, so first dialog box OnInitDialog function is being called in that function second dialog box DoModal function has been called... Now what i want is if second dialog box return 1 i.e its successful then only first dialog box should be constructed and do its processing otherwise it should not be constructed.....
for example
CFirstDialog dlg;
dlg.DoModal();
BOOL CFirstDialog::OnInitDialog()
{
CSecondDialog dlg1;
int ret_val = dlg1.DoModal();
if(ret_val == 1)
return true;
else
return false;
}
but this code is not solving my problem...
its giving me a dialog box(first) in not working condition....
how to do this....
can anybody help me in this...
thanks in advance
|
|
|
|
|
Why do you want to do that in the OnInitDialog from CFirstDialog ? Can't you simply move the condition check at the place where you create CFirstDialog originally ? There you first create CSecondDialog and if the return condition is not what you expect, then you don't create CFirstDialog. Seems a bit better than putting that in the OnInitDialog...
|
|
|
|
|
Cedric's answer is good - you're testing too late. Why go to all the bother of making a dialog then throwing it away?
Saying that, you may have a very good reason.
So...
As you're a VCProgrammer, you should be familiar with documentation. OnInitDialog / WM_INITDIALOG has some too. Here's an extract:
Return Values
The dialog box procedure should return TRUE to direct the system to set the keyboard focus to the control specified by wParam. Otherwise, it should return FALSE to prevent the system from setting the default keyboard focus.
You don't get to make up the meaning of returns values for messages you didn't invent. Otherwise windows programming would be a whole lot more... interesting...
I'm pretty sure you can call EndDialog from within OnInitDialog though, which would give you a hacky answer - but Cedric's solution would be a lot cleaner.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
modified on Thursday, February 12, 2009 5:05 AM
|
|
|
|
|
just call EndDialog() instead of return false;// dialog should not be created
aks
|
|
|
|
|
Hi All,
I have used a List box control. But i cant show the automatic scroll down when something added in the list box. I cannot see which item added recent. If i want to see i have to scroll down by mouse.
Thanks to all
Regards
Munna
|
|
|
|
|
Use the CListBox::SetTopIndex()[^] function. Pass the index of newly add item to this function to bring that item to visible.
|
|
|
|
|
Additionally to what Naveen said, there is also CListCtrl::EnsureVisible[^].
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hi All,
Is there any API to know about the 32 or 64 bit machine?
|
|
|
|
|
|
Hello
I would like to create the project using c++ to read and write to binary file ( actually the file required to read and write is a RAW image file). The project should be win32 console application. Could you show me how to do it (step by step) ? The code I could write but where to write and how to connect the c++ program to the binary file I do not know
thank you very much.
|
|
|
|
|
Visual Studio provides you the skeleton of a console application, so the first part of your requirements is simply accomplished.
Writing and reading a binary file is pretty simple (just read the documentation [^]- For sample code, see for instance [^]).
If you find cumbersone (at first sight it may appear as such) C++ iostream programming, then you have two options:
- Going back to
VB6 (just kidding ). - Using goldie/oldie
C Stream I/O [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
In my code, I have created a Popup Menu containing a large number of menu items (does not fit in a single view). I display the same using TrackPopupMenuEX on the Menu handle.
The first time around when the Menu pops up, the the top most items of the menu are visible. Now if I scroll down the menu so that some other items are visible and close the menu in this state, the next time around when the same menu is popped up, the menu area and items visible is the same as When I had closed the menu in previous operation. The previous closing state of the menu is some how getting saved automatically.
I want to change this behavior. I want to change it such that the menu area visible on popup starts with the menu item I specify (either by Command ID or Position). Is this possible? How can I achieve it.
Thanks in advance..
P.A.Ajay Kumar M.Tech(IT) B.Tech(CS)
|
|
|
|
|
pa_ajaykumar wrote: I want to change this behavior
No, what you want to change is how you organise that popup's UI - think about your users - having a menu that large is insane.
Either categorise the menu entries by function type, or alphabetically, or something that makes sense, and then use those categories to populate sub-menus.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Well, the thing is that this pop-up menu is not going to be a right click context menu. Its a font selection menu which is going to be popped up over a button. Its bound to have so many items due to the number of fonts and the menu is already hierarchical (families as main menu items and styles as sub menu items). So further grouping is not an alternative.
P.A.Ajay Kumar M.Tech(IT) B.Tech(CS)
|
|
|
|
|
What's wrong with the standard font select dialog? Or grouping the fonts alphabetically (split fonts into groups starting with A-F, G-M, N-T, U-Z).
Anyway - the only way I know of to get the menu to forget it's selected location is to recreate it each time you show it.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi All,
I need to display a blinking cursor on the view but without using any control. How to do it?
Thanks
|
|
|
|
|
The blinking cursor is called a Caret and can be created using the CreateCaret function and shown using the ShowCaret function.
«_Superman_»
|
|
|
|
|
Hi Experts,
I have ATL DLL with Addition() method,
I calling this function from another MFC application with no argument
Code goes like :
Assume no syntax errors
CLSID cls_id;
CLSIDFromProgID(L"DLLTest.MyObject",&cls_id);
CComPtr<IDispatch> pService;
HRESULT hr = pService.CoCreateInstance(cls_id, NULL, CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER);
if(hr == S_OK)
{
DISPID Disp_id;
CString bsvalue;
CComVariant Result;
OLECHAR *member=_T("Addition");
DISPPARAMS param = {NULL,NULL,0,0};
hr = pService->GetIDsOfNames(IID_NULL,&member,1,LOCALE_SYSTEM_DEFAULT,&Disp_id);
if(S_OK == hr)
hr = pService->Invoke(Disp_id,IID_NULL,LOCALE_SYSTEM_DEFAULT,DISPATCH_METHOD,¶m,&Result,NULL,NULL);
else
MessageBox(L"Could not get disp id",L"MSG",MB_OK);
}
else
MessageBox(L"No Interface",L"MSG",MB_OK);
This code works fine but,
now I want to call same function Addition() with two arguments, I have made respective chages in DLL, so please give me solution or hint
|
|
|
|