|
Bravoone_2006 wrote: How can i remove spaces in my database ?
You asked the same question
Here
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I guess i saw this question previous
|
|
|
|
|
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
You really must STOP reposting every one of your questions. If you didn't get an answer the first time, then it's doubtfull you will get one the second.
|
|
|
|
|
Bravoone_2006 wrote: How can i remove spaces in my database ?
Asking the same question on two consecutive days is not going to get you a different answer. Are you just plain incapable of heeding suggestions? Folks here have gone way out of their way to help you and you've not so much as lifted a finger to apply anything. That's called lazy and selfish!
Bravoone_2006 wrote: tank you in advance !
Tank is a slang verb that means to fail. Hopefully this is not your mantra.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello!Does anyone know if you can monitor a printer and count the number of print jobs in the queue?Say if there is more than 10 documents/jobs then i need to stop the Print service. (Use VC)
thanks
From Neusoft
|
|
|
|
|
hsdok wrote: Does anyone know if you can monitor a printer and count the number of print jobs...
What's wrong with EnumJobs() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello Everyone, I am here again with a UNICODE Question. I hope this is the last one . I am trying to create a tstring from a char[]. From the debugger the contents of the string looks correct but when I try to use it in an DirectX api call it compiles and runs but does not function correctly. I have seen this error before and it was down to using ASCII instead of UNICODE and I solved it by defining UNICODE and using _T() either when creating a string or harding coding a api call param. But this does not work with a char[]. Here is my code:
#ifdef UNICODE<br />
typedef wstring tstring;<br />
#else<br />
typedef string tstring;<br />
#endif<br />
<br />
char szFile[350];<br />
ofn.lpstrFile = (LPWSTR)szFile;<br />
tstring fileName (ofn.lpstrFile);<br />
D3DXGetImageInfoFromFile(fileName.c_str(), &Info);<br />
<br />
I have only put in the code that directly relates to what I think is the problem for clarity sake. The code works if I replace fileName.c_str() with _T("actual file path") which is why I think the problem is with how I have encoding the string. Is the problem with (LPWSTR)? I did not think so as I was only getting it to point to the array. Any help is really appreciated.
|
|
|
|
|
BarryOg wrote: #ifdef UNICODE
typedef wstring tstring;
#else
typedef string tstring;
#endif
Shouldn't this be...
#ifdef _UNICODE
typedef wstring tstring;
#else
typedef string tstring;
#endif
BarryOg wrote: char szFile[350];
//create a file dialog info struct and fill it up as required than point it too our char buffer
ofn.lpstrFile = (LPWSTR)szFile;
You are asking for trouble...
Instead do this...
TCHAR szFileBuffer[MAX_PATH];
ofn.lpstrFile = szFileBuffer;
|
|
|
|
|
To properly convert, you can use the MultiByteToWideChar() function, and to go the other way, you can use WideCharToMultiByte(). These will convert between ANSI/MBCS and UNICODE and vice versa.
You can use casts as much as you like to convince the compiler, but the data stays the same.
WCHAR buf[_MAX_PATH];
#if !defined(UNICODE)
int n = MultiByteToWideChar(CP_ACP, 0,
filename.c_str(), filename.length(),
buf, _MAX_PATH);
if (n>=0)
{
buf[n] = L'\0';
}
#else
wcscpy(buf, filename.c_str());
#endif
D3DXGetImageInfoFromFile(buf, &Info);
Steve S
Developer for hire
|
|
|
|
|
Thanks for the replies, neither of the solutions seem to fix my problem, I'm going to go read about character encoding in detail and figure out exactly what I'm doing wrong instead of just bashing around and than asking for help.
|
|
|
|
|
Looking again at your example, you have #ifdef UNICODE to type the std::string you want, but then later on you use a char buffer and an explicit cast.
You could use a TCHAR buffer (and no cast), which would give you whatever the compile flags say you're using (UNICODE/wchar ANSI/char). That way you may not need to do conversions at all in many cases, or use conditional conversion for different builds.
Don't despair.
Getting to grips with UNICODE when all you've done before used simple char[] stuff takes time.
Use the debugger to examine memory (not just display strings) so that you can see whether what you have in various places is what you think you should have.
Steve S
Developer for hire
|
|
|
|
|
Thanks for the encouragement , I've been busy last few days but hopefully will give this a shot tonight.
|
|
|
|
|
Hi,
can aynone tell me where can i get a program that involves threads in serial communication...
Pragya
Life is not tomorrow...
|
|
|
|
|
Have a look at Joe Newcomer's article about serial programming here[^].
He describes a way of doing serial communication that I've used myself for several years and it's both fast and reliable.
It's also a good idea to read some of his other articles to get a better understanding of multithreading and message management.
Hope this helps
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
Dear sirs,
Last time I had a problem to align numbers of my list. Someone advise me to change the font and it was ok.
Now I change printer from Laser printer to Dot matrix printer . There is now a new problem, the font is very big when I print from dot matrix printer.But from laser it's good. What font to choice so to align numbers and to printer well from dot matrix or laserjet printer.
this my font i use now:
font.CreateFont(80,0,0,0,FW_DONTCARE,FALSE,FALSE,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_MODERN,"Courrier");
dc.SetMapMode(MM_TEXT);
Thanks to all can help me
|
|
|
|
|
I think 80 is big
|
|
|
|
|
Typically you don't hard-code sizes in this way.
You ask the device what size dots it has, and then use that to calculate how big to make the font.
If you have a device context, you can use GetDeviceCaps to retrieve the number of dots in an inch (for vertical and horizontal, coping with the case where dots do not have an aspect ratio of 1:1).
For instance, to get 10 point, you can do this;
int pt = -MulDiv( 10, GetDeviceCaps(dc, LOGPIXELSY), 72);
and that would be the size to use. The different DCs for printers and the screen will give you answers appropriate to the device. Lasers, for instance, might have between 300 and 1200 dpi, while a screen is theoretically 96dpi. Dot matrix printers might be 120 dpi.
By specifying the value as a negative number, the font mapper transforms this value into device units and matches it against the cell height of the available fonts, giving hopefully better results.
In MFC, you can use CreatePointFont or CreatePointFontIndirect and pass in a DC, so that it can correctly calculate the right values for you.
Since the height is in device dots, using the same value for different devices will generally give you odd results.
Steve S
Developer for hire
|
|
|
|
|
Thanks for your reply, I try with mulDiv(8,GetDeviceCaps,LOGPIXELY,72) to detrmine the size.
It's OK ,but I have another problem on dot matrix, the same line is printed twice in the same line in horizontal like:
------------------- -------------------
Why ?
I am using Lx 300
On deskjet and LAser no problem
|
|
|
|
|
How are you deciding where to print?
Again, if you're using MM_TEXT mode, you need to determine Y values correctly for line positioning. You can do this by determining the printing height of a single line, using GetTextMetrics(dc, &tm) where tm is a TEXTMETRIC structure. This will give you tm.tmHeight which is the line height, you may want to add tm.tmExternalLeading to space the lines out more. Or again, to print at positions relative to the page top, if you know the distance in say, inches, you can use MulDiv again to calculate Y values.
If you have
yInch = GetDeviceCaps(dc,LOGPIXELSY);
then 1.1" down would be
MulDiv(720+72, yInch, 720)
Steve S
Developer for hire
|
|
|
|
|
This all my code when I print.
With dot matrix printer I print only the first dc.TextOut but others are not printed.
With LAser or deskjet printer all is printed, no problem here.
What to do ? so to print on dot matrix what I need like:
CFont font;
font.CreateFont(-MulDiv (8, dc.GetDeviceCaps (LOGPIXELSY),72),0,0,0,FW_DONTCARE,FALSE,FALSE,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_MODERN,"Courrier");
dc.SetMapMode(MM_TEXT);
CFont* pOldFont = (CFont*) dc.SelectObject(&font);;
dc.GetTextMetrics(&tm);
nHeight = tm.tmHeight + tm.tmExternalLeading ;
hauteur = nHeight; l += 1;
strCommand.Format("|%-50s","Matric." );
dc.TextOut(Info.m_rectDraw.left ,Info.m_rectDraw.top + (l * hauteur) , strCommand);
strCommand.Format("|%-80s","Nom" );
dc.TextOut(Info.m_rectDraw.left + 300 ,Info.m_rectDraw.top + (l * hauteur) , strCommand);
strCommand.Format("|%-50s","Postnom" );
dc.TextOut(Info.m_rectDraw.left + 900 ,Info.m_rectDraw.top + (l * hauteur) , strCommand);
strCommand.Format("|%-50s","Initial" );
dc.TextOut(Info.m_rectDraw.left + 2500 ,Info.m_rectDraw.top + (l * hauteur) , strCommand);
strCommand.Format("|%-50s","Nb.retenu" );
dc.TextOut(Info.m_rectDraw.left + 3000 ,Info.m_rectDraw.top + (l * hauteur) , strCommand);
strCommand.Format("|%-50s","Restant" );
dc.TextOut(Info.m_rectDraw.left + 3500 ,Info.m_rectDraw.top + (l * hauteur) , strCommand);
Urgent
|
|
|
|
|
Thanks for your reply, I try with mulDiv(8,GetDeviceCaps,LOGPIXELY,72) to detrmine the size.
It's OK ,but I have another problem on dot matrix, the same line is printed twice in the same line in horizontal like:
------------------- -------------------
Why ?
I am using Lx 300
On deskjet and LAser no problem
|
|
|
|
|
Hi all,
some time ago, i had to write a program which starts other executeables (i did this with CreateProcess). Not a single process started was depending on the termination of another started one. Since then, the requirements changed and i have to include the execution of processes which depend on the termination of other processes. as i am not a programmer in general, i have no idea how this could be done. could someone please guide me how to do this?
CreateProcess A.exe --> A.exe is working without a dependency
CreateProcess B.exe --> Should be started when A.exe terminates
CreateProcess C.exe --> Should be started when B.exe terminates
Thanks in advance,
nmx
|
|
|
|
|
U can use the handle returned by CreateProcess as a parameter to WaitForSingleObject(..).. This will make your process wait for the process to exit and then continue.
<br />
In ur scenario it will be,<br />
HANDLE hprocessa = CreateProcess("a.exe", .. other parameters);<br />
WaitForSingleObject( hprocessa, INFINITE );<br />
HANDLE hprocessb = CreateProcess("b.exe", .. other parameters);<br />
WaitForSingleObject( hprocessb, INFINITE );<br />
CreateProcess("c.exe", .. other parameters);<br />
Chao!
|
|
|
|
|
Ciao nutkase. Thanks for your answer.
This is exactly the way i do it right now, but this is way too unflexbile. Lets say I want to start another Process D while Process A is running. Process B and C are waiting for the termination of Process A. If I use WaitForSingleObject(A, INFINITE) on Process A, i won't be able to execute another process (Process D) at the same time.
What i think about is having Events for the termination of a process.
Greets, nmx
|
|
|
|
|