|
hmmm - does it support those elven-characters from Lord of the Rings ?
|
|
|
|
|
Yes you can use unicode. However you cannot use the uncode functions built into windows, because they use UCS-2 which is only 16 bit.
I would typedef unsigned long to something like my_unicode_type, so that if you come up with something better latter you only need to change your type in one place. This depends though, if you are writting a class to wrap everything it might not be required.
|
|
|
|
|
I use Teradata database.
Teradata has a SQL Statement :show table mytable;
This statement can return the definition of mytable.
But CRecordset class cann't run this SQL.
CDatabase can do it,but CDatabase.ExecuteSQL function has no return .
strSQL = "Show table mytable;";
set.Open(CRecordset::forwardOnly,(LPCTSTR)strSQL,CRecordset::none);//Error !
database.ExecuteSQL(strSQL);//OK,but how can I get the result?
How can I run this SQL and get the result?
Thanks.
|
|
|
|
|
willyfu wrote:
How can I run this SQL and get the result?
Getting the results from a stored procedure is not that difficult. One way of doing it is shown in MSDN article Q183001.
Here is another.
Here is a helpful discussion.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
finally,I found the ODBC API solution.
CString strSQL;
SQLLEN nRecCount,nFieldLen;
strSQL.Format("Show table mytable;");
CRecordset set(&database);//Create a CRecordset object
SQLExecDirect(set.m_hstmt,(SQLCHAR*)strSQL.GetBuffer(strSQL.GetLength()),strSQL.GetLength());
SQLRowCount(set.m_hstmt,&nRecCount);
for(int n = 0;n < nRecCount; n++)
{
SQLFetch(set.m_hstmt);
SQLGetData(set.m_hstmt,1,1,str1.GetBuffer(32000),32000,&nFieldLen);
str1.ReleaseBuffer();
}
that's all.
|
|
|
|
|
While it may work, this is a very odd use of a CString object. I'm curious why you are using a CRecordset object if all you need access to is its m_hstmt member.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have a prjt which compiles without errors, but keeps displaying an error message on execution. The error message is only supposed to appear when a certain variable x, is less than or equal to zero. Only one function calls the function that contains this error message. Even after "ensuring" that x has a postive variable, I still get the error message on execution.
My fxn which contains the error message is as follows:
<br />
void ei(double *x, double *expi, int nSize)<br />
{<br />
enum{nSize = 100};<br />
const int MAXIT = 100;<br />
const double EULER=0.577215664901533;<br />
const double EPS=1e-20;
<br />
<br />
<br />
int k;<br />
double fact[nSize], prev[nSize],sum[nSize],term[nSize];<br />
<br />
for(int t=0;t<nSize;t++)<br />
{<br />
if (x[t]<=0.0)<br />
{<br />
AfxMessageBox("x value incorrect, in ei!", MB_OKCANCEL|MB_ICONSTOP);
exit(1);<br />
}<br />
<br />
if (x[t]<EPS)<br />
{<br />
expi[t]=log(x[t])+EULER;
}<br />
<br />
if (x[t]<=-log(EPS))<br />
{<br />
sum[0]=0.0;<br />
fact[0]=1.0;<br />
<br />
for (k=1;k<MAXIT;k++)<br />
{<br />
fact[t] *= x[t]/k;<br />
term[t]=fact[t]/k;<br />
sum[t] += term[t];<br />
if (term[t]<EPS*sum[t]) break;<br />
}<br />
<br />
if (k>MAXIT)<br />
{<br />
AfxMessageBox("Series failed in ei!",MB_OKCANCEL|MB_ICONSTOP);<br />
exit(2);<br />
}<br />
<br />
expi[t]=sum[t]+log(x[t])+EULER;<br />
}<br />
<br />
else<br />
{<br />
sum[0]=0.0;<br />
term[0]=1.0;<br />
<br />
for (k=1;k<MAXIT;k++)<br />
{<br />
prev[t]=term[t];<br />
term[t] *= k/x[t];<br />
<br />
if (term[t]<EPS) break;<br />
<br />
if (term[t]<prev[t]) sum[t] += term[t];<br />
<br />
else<br />
{<br />
sum[t] -= prev[t];<br />
break;<br />
}<br />
}<br />
<br />
expi[t]=exp(x[t])*(1.0*sum[t])/x[t];<br />
}<br />
}<br />
}
the only place where the above function is used is:
<br />
void unbound(double *unbd, int nSize)<br />
{<br />
enum{nSize = 100};<br />
double A[nSize],B[nSize],k0[nSize],k1[nSize],s[nSize],expi[nSize],a[nSize],b[nSize];<br />
<br />
s[0] = 1;<br />
for (int t=1;t<nSize;t++)<br />
{<br />
double x;
<br />
CKuchukDlg MyClas; <br />
MyClas.m_dWellRad = x;<br />
<br />
void bessk0(double *x,double *k0,int nSize);<br />
void bessk1(double *x,double *k1, int nSize);<br />
void ei(double *x, double *expi, int nSize);<br />
<br />
s[t] = 2*t*PI;<br />
a[t] = x*sqrt(s[t]);<br />
b[t] = 2*sqrt(s[t]);<br />
<br />
bessk0(a,k0,nSize);<br />
bessk1(a,k1,nSize);<br />
ei(b,expi,nSize);<br />
<br />
A[t] = k0[t]/(x*sqrt(s[t])*k1[t]);<br />
B[t] = (1-exp(-2*sqrt(s[t])))/(2*sqrt(s[t]));<br />
<br />
unbd[t]=0.5*(A[t]-B[t]-expi[t]);<br />
}<br />
}<br />
could someone please tell me where im missing it? Thank you!
|
|
|
|
|
I need someplace where I can filter all application messages of the application (main window and all child windows and dialogs).
|
|
|
|
|
Look into SetWindowsHookEx
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
Hi guy!
I am formatting html tags from my vc application. I need to print tickets in each page separatedly. Do we have any tags for page break. So that each ticket is printed in a separate page! I would be grateful if anybody can help!
Thanks.
|
|
|
|
|
I'm not sure if this will help, but:
You may want to look into the css attribute page-break-before . I think that's it...
HTH
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
Hi All,
I am using static control on a dialog box in MFC.The text which is to be shown in the static control is to big to fit in it so its gets crop (half text displayed).Is there any way by which i can acheive text wrapping in the static control?
Thanks
Pushkar
|
|
|
|
|
The text is automatically wrapped in a static control. Increase the rectangle size vertically in the resource editor.
You can try to do that at run-time too and for that you will have to increase the static box size w.r.t the number of possible lines.
|
|
|
|
|
Thanks Genius_Logics,
I tried the solution given by you but it is not working. I increased the size of static control vertically but still text gets cropped
Any guess?
Thanks
Pushkar
|
|
|
|
|
well.....
this idea might sound stupid(and there might be a better way to do it,well anyway.....)
u c the CStatic control doent seem to have function that could change itz size......BUT it happenz to be derived from the CWnd class(aaaahaa!!!!!).....lol.....so u can try to use the function.....
mystaticobject.SetWindowPos(.....)
where mystaticobject is an object of CStatic.....so based on the lenght u can make a code that could keep changing the height of the static window
tis just a suggestion.....and hope it will help.....
happy programmin.....
cheerz.....
|
|
|
|
|
I have a check box in my dialog, and make it as a push like style. And i want to show some bitmap over it. so i declare a cbitmapbutton object, and create the cbitmapbutton object with a owner draw style, then attach the check box with the cbitmapbutton object using the function: autoload. But I found the cbitmapbutton's drawitem function won't be called when we show the check box!! Could i owner draw the check box? (when i just use a button, this is no problem)
Thanks a lot
|
|
|
|
|
Hey,
I want to use macros in my application.
Can any one tell me the effect of Macros on performance of application and the reasons behind it.
Thanks a lot,
Amit.
|
|
|
|
|
There is no runtime performance hit when using macros. They are expanded/inlined by the preprocessor.
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
macros are #define s, that means that the preprocessor copies its definition where the macro was called, like inline functions are.
but BE CAREFUL, macros can be very bad. consider the following :
<font color=#0000FF>#define</font> INCRZ(xx) xx + 1
if you then call this :
<font color=#0000FF>int</font> i = 2;
INCRZ(2); <font color=#008000>
OK, i == 3 at the end.
and what about this ? :
<font color=#0000FF>int</font> i = 2;
i = 5 * INCRZ(i)<font color=#008000>
BAD CODE !! here is how the preprocessor inlines the macro :
i = 5 * i + 1;
At the end, i is evaluated as : i = (5 * i) + 1; because you might know that multiplication is prior on addition.
be careful so when designing macros, and put a maximum af parenthesis :
<font color=#0000FF>#define</font> INCRZ(xx) ((xx) + 1)
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hello
Could anyone please tell me the difference between memory address space and I/O address space.
/sreekanth
|
|
|
|
|
How do you programmatically set transparent color in a gif file? For example I have a gif file "c:\\a.gif", I wish to:
Open c:\\a.gif.
Set the black color, RGB(0,0,0), as the transparent color.
Save the file back to c:\\a.gif.
After that when I open c:\\a.gif using photoshop or whatever, the gif displays black as transparent color.
Can we do that? Thank you.
|
|
|
|
|
Hi
How we can search for a case insensitive string in CMapStringToOb class. Lookup function supports case sensitive search. Is there any way to implement the case insensitive search?
Regards
|
|
|
|
|
The most efficient way I can suggest is the store your key string as all lowercase or all UPPERCASE. Then when you do a search, convert your search string first to lc/UC then to a lookup.
Otherwise the variations on uppercase/lowercase letters in your string would just be too much to think looping through.
I Dream of Absolute Zero
|
|
|
|
|
Hi,
How can I get an open file dialog similar to the one in Office 2003 with Visual C++ 6.0 ?
Thanks
Claude
|
|
|
|
|
ok... when i try and compile this code i keep gettin the error "fatal error C1010: unexpected end of file while looking for precompiled header directive"
anyone know y this is happening and how to help?
[code]//NFL Favorite Team
#include <iostream.h>
int main()
{
int NFL;
std::cout << "Who is the best team in the NFL?\n";
std::cout << " (please only use the first three letters in the teams name *not city*)\n";
std::cin >> NFL >> endl;
if (NFL=Ste)
std::cout << "We Have a Winner!!!! *claps*\n";
else
std::cout << "How wrong could you be? Have you ever heard of a little team called the STEELERS?!\n";
return();
}[/code]
|
|
|
|