|
Super Lloyd wrote: The fact it doesn't seems to work on vista and later where I should use GetLocalInfoEx() is a problem.
I'm not sure what you mean by this, but GetLocaleInfo() dates all the way back to Windows 2000, whereas GetLocaleInfoEx() works on Vista and newer.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
#define MyTemplate( filename ) "D:/Template/MyApp/" # filename
#include MyTemplate( stdafx.h ) // failed to compile
int main()
{
cout << MyTmeplate( stdafx.h ) // ok, print "D:/Template/MyApp/stdafx.h"
}
How to include files in "D:/Template/MyApp/" if I don't copy them to my own project directorie?
solution like the macro doesn't work perhaps #include instruction doesn't accept another '#' in its statement.
Could someone help me, thanks in advance!
|
|
|
|
|
I recommend you have a look at Token Concatenation[^]. That explains how to define and use a C macro to concatenate tokens.
|
|
|
|
|
Considering you're using stdafx.h, I assume you are using Visual Studio? Why not just add the include directory to Additional Include Directories in the Project Properties dialog, under the C/C++ tab. That way, there's no need for possibly troublesome macro's and makes it easier to maintain.
For other build environments there should be similar options.
|
|
|
|
|
Thank you. That's a nice solution.
|
|
|
|
|
I found another trouble, I have to include the D:\template for every individual project. Is it possible to include it like "VC98\include" as an one-time-job ?
|
|
|
|
|
In vs2005,
1. Go to Tools->Options
2. Click on projects and solutions tree item
3. Select vc++ directories item
4. Select Include files in drop down window "Show Directories for"
5. Then add your include directory.
I think it will be same in all VS IDE.
http://www.mono-project.com/Main_Page
|
|
|
|
|
void CFLUpdaterDlg::Print(CString s_Format, ...)
{
va_list args;
va_start(args, s_Format);
int BUFLEN = 1024;
CString s_Out;
TCHAR* t_Out = s_Out.GetBuffer(BUFLEN+1);
_vsntprintf(t_Out, BUFLEN, s_Format, args);
t_Out[BUFLEN] = 0;
s_Out.ReleaseBuffer();
if (s_Out.GetLength() == BUFLEN)
s_Out.Replace(_T("\r"), _T(""));
s_Out.Replace(_T("\n"), _T("\r\n"));
ms_Output += s_Out;
m_Print.SetWindowText(ms_Output);
return;
}
void CFLUpdaterDlg::OnBnClickedStartserver()
{
if(!serverstarted)
{
TCHAR PortNumber[260];
m_PortTxT.GetWindowTextA(PortNumber,260);
m_Port = atoi(PortNumber);
Print("Server Started on port %i\n",m_Port);
serverstarted=true;
AfxBeginThread( ServerEXE,(LPVOID)m_Port, THREAD_PRIORITY_NORMAL);
}
else
{
Print("Server Allready Running\n");
}
}
UINT CFLUpdaterDlg::ServerEXE(LPVOID param)
{
CFLUpdaterDlg out;
int host_port = (int)param;
out.Print("port = %i\n",host_port);
return 0;
}
i seem to be geting memory overflows it prints out OnBnClickedStartserver info no problem but when i try to print from the thread instant overflow
|
|
|
|
|
kosacid wrote: m_Port = atoi(PortNumber);
Is m_Port a pointer?
kosacid wrote: AfxBeginThread( ServerEXE,(LPVOID)m_Port, THREAD_PRIORITY_NORMAL); Why are you casting an int to a pointer? If m_Port is a global int , you'd need something like:
AfxBeginThread(ServerEXE, (LPVOID) &m_Port, THREAD_PRIORITY_NORMAL);
kosacid wrote: int host_port = (int)param;
This does not look right. If param is supposed to be treated as a pointer to an int , you'd need:
int host_port = *((int *) param); or
int *host_port = (int *) param; Also, why are you having the secondary thread interact with a UI element? Only the primary thread (the one that owns the UI element) should do that.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
it passes the param ok its not that its definitly the print function seems to be
m_Print.SetWindowText(ms_Output);
ms_Output contains say "port = 100" if i set it to 100
seems that m_Print.SetWindowText(ms_Output); cant find the edit box its pointing to 0
|
|
|
|
|
kosacid wrote: cant find the edit box its pointing to 0
No surprise since you are attempting this from a secondary thread.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
that dosent realy help me out can you maby sugest a way on how to do it
maby give me a push in the right direction i mainly program in c++ and c
what works for that dosent seem to work in visal c++
|
|
|
|
|
Like I mentioned earlier, you should refrain from interacting with any UI element from any thread other than the one that actually owns the element. See here for more, specifically the "Worker threads and the GUI II: Don't touch the GUI" section.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
I work in VC6 and I need for some project atlimage.h to include in my project. My question is , where can I find it for download ? I mention that I search along for this , but I didn't find it ... can you help me ? Thank you.
|
|
|
|
|
|
Should I understand that is not enough to find somewhere altimage.h and include in foolder project ? Because my error is :
E:\Flaviu\Temp\ImageComparator\ImageComparator\stdafx.h(44): Could not find the file atlimage.h.
|
|
|
|
|
it cannot be included from external source, it is the part of atl library. And VC6 doesnot contains it.
atlimage.h is found from vs2003 or maybe vs2002 and above.
you can use WIN32 way to accomplish your task.
Regards,
Vishal
|
|
|
|
|
I think that I understand now thank you.
|
|
|
|
|
Hi, I am facing a strange font problem
<br />
Font Name : Aparajita<br />
Language : Hindi<br />
<br />
Platform : C++ Win32 (NO MFC)
I created a dialog with a simple edit control.
When i enter the path displayed below in the edit control,
Everything is displayed in correct size,
But only the hindi text is displayed very small. Just unreadable.
Path Entered: C:\Hello World\सरकारी\Files
I have tested this with Chinese Font. It is ok.
How to over come this problem. Please help.
Thanx 4 everyone, problem solved.
Regards,
Vishal
modified on Wednesday, June 8, 2011 12:11 AM
|
|
|
|
|
Make all the text smaller and no one will notice... 
|
|
|
|
|
i can't, becoz if i make all the text smaller the hindi text seems like dot dot dot...
Regards,
Vishal
|
|
|
|
|
I've never played with different texts... so can't help too much there...
|
|
|
|
|
1) Is Aparajita is Hindi font and
2) Is सरकारी is unicode string or ascii string?
If it is unicode than you must choose the font as Mangal and than check.
"Every Little Smile can touch Somebody's Heart...
May we find Hundreds of Reasons to Smile Everyday... and
May WE be the Reason for someone else to smile always!" (ICAN)
"Your thoughts are the architects of your destiny."
|
|
|
|
|
SP 24 wrote: 1) Is Aparajita is Hindi font and
Yes
SP 24 wrote: 2) Is सरकारी is unicode string or ascii string?
Unicode String
SP 24 wrote: If it is unicode than you must choose the font as Mangal and than check.
Checked with Mangal. The result is same.
Actually the string contains both english and hindi.
Regards,
Vishal
|
|
|
|
|
I am facing this problem with Bengali and Oriya only but not in Hindi. Please check that you have Mangal font installed in your system?
It should be in SystemDrive:\Windows\Fonts folder. One more thing that I do is copy the font of mangal in Windows 7 or Vista and installed it in your pc. Might be your problem is resolved.
"Every Little Smile can touch Somebody's Heart...
May we find Hundreds of Reasons to Smile Everyday... and
May WE be the Reason for someone else to smile always!" (ICAN)
"Your thoughts are the architects of your destiny."
|
|
|
|