|
Try this
WCHAR disname[100]={0};
CStringW name;
name= m_IniReader.getKeyValue(str,"VIEWNAME");
wcscpy(disname, (LPCWSTR)name.GetBuffer(100));
MessageBoxW(NULL,disname,disname,MB_OK);
name.ReleaseBuffer(100);
|
|
|
|
|
Mohan Ramachandra wrote: wcscpy(disname, (LPCWSTR)name.GetBuffer(100));
No, calling GetBuffer is really a very bad practice. You shouldn't do that, the CString class already provides cast operators so there's no need to call GetBuffer !
And the the case is probably no needed neither, but that depends how the project was compiled (UNICODE or not).
|
|
|
|
|
i heard a lot of time calling GetBuffer a bad practice,
why do so?
Ajayraj
|
|
|
|
|
GetBuffer (as the name suggests) exposes the internal buffer of the CString object.
Moreover you must remember to call ReleaseBuffer when you've done with it. Most of the times, you really don't need to call it.
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]
|
|
|
|
|
Because if you read the documentation of the function, you will see that you get a pointer to the internal buffer of the string and that you HAVE to call ReleaseBuffer afterward (which will be often forgotten). Furthermore, why would you use GetBuffer, while the CString provides a cast operator which returns you the same thing ?
Calling GetBuffer can lead to mistakes if you forget to call ReleaseBuffer.
|
|
|
|
|
Cedric Moonen wrote: No, calling GetBuffer is really a very bad practice. You shouldn't do that, the CString class already provides cast operators so there's no need to call GetBuffer !
Thanks, I didn't know that
|
|
|
|
|
|
Did u check the whether you are getting the japanese text in CString?
And i hope its a UNICODE build.
Величие не Бога может быть недооценена.
|
|
|
|
|
yes i m getting japanese text in CString.
|
|
|
|
|
Please check whether _UNICODE preprocessor is added in your project setting.
Величие не Бога может быть недооценена.
|
|
|
|
|
CString name;
WCHAR disname[100]={0};
name= m_IniReader.getKeyValue(str,"VIEWNAME");;
wcscpy(disname, A2W((LPCWSTR)name));
Use this code. And make sure that your project build support UNICODE.
Raj Jaiswal
|
|
|
|
|
Hi,
My application is a MDI application and looks like,above the frame(mainframe caption bar)one modeless dialog always displaying.
My problem is in order to move the applicaton to secondary monitor,we normally do- Restore down the window,and clicking on the blue caption bar we drag the window and move to secondary monitor.
But my application always having dialog on top,i cannot click on the caption bar,so i cannot move to secondary monitor.
So pls anybody of you kindly explain how can i move that.
Anu
|
|
|
|
|
You could define a "hot place" on your dialog
to process the following reactions there on :
- WM_LBUTTONDOWN to set a "hot place flag" and the mouse capture
- WM_MOUSEMOVE to move the dialog and the main frame, if the "hot place flag" was set
- WM_LBUTTONUP to reset the "hot place flag" and release the mouse capture
virtual void BeHappy() = 0;
|
|
|
|
|
I use C++ to create two XLL's A.xll and B.xll. A function in A.xll requires B.xll. If I compile A.xll with a project dependency on B.xll, then Excel does not register the functions in A.xll. If I compile A.xll without the project dependency and only include B.lib, then all functions are registered.
What is the reason? Is it a bug in Visual Studio compiler or some other issue?
|
|
|
|
|
Hi,
The following is TCP/IP packets collected by Wireshark:
34 16:09:29.056911 10.10.10.7 10.10.10.100 TCP 49167 > amiganetfs [PSH, ACK] Seq=55 Ack=1567 Win=64240 Len=6
35 16:09:29.193003 10.10.10.100 10.10.10.7 TCP amiganetfs > 49167 [PSH, ACK] Seq=1567 Ack=61 Win=5632 Len=1
36 16:09:29.386529 10.10.10.7 10.10.10.100 TCP [TCP Retransmission] 49167 > amiganetfs [PSH, ACK] Seq=55 Ack=1567 Win=64240 Len=6
What is happening here is 49167 sends 6 bytes to amiganetfs which acknowledges them and sends one byte back, then 49167 resends the packet 34 as if it didn't receive the ack (but it was received and picked up by Wireshark). It seems that ack was ignored by 49167. Any idea why it's happening so?
|
|
|
|
|
What does this have to do with C++ ?
|
|
|
|
|
It may be possible that the ACK did not reach the other side. Capture on both the sides and see.
BTW, Nobody will be able to help you further on this if you don't post
the exact code which transmits the packet and receives the packet.
"I'm willing to admit that I may not always be right, but I am never wrong." - Samuel Goldwyn
|
|
|
|
|
I am new to c++. I need to use a vector to store array with flexible length. That is in a loop, for each index i, the length of the array x[i] is change.
Please give me the declaration and code fragments.
Thanks
|
|
|
|
|
A simple google[^] search is the best help sometimes, the first hit seems to be promising already.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Sounds like, in the most general case, you're after a std::vector of std::vector s:
typedef std::vector<int> InnerType;
typedef std::vector<InnerType> OuterType;
OuterType my_array;
Or you can construct the type directly without the typedef s (I'd use the typedef s personally):
std::vector<std::vector<int> > my_array;
Steve
|
|
|
|
|
try it this way
vector<int> countVal;
vector<int> ArrInts;
#This can be a loop to assign values of flexible length .I have kept it simple
countVal.push_back (12);
countVal.push_back (13);
countVal.push_back (14);
ArrInts.assign(countVal.begin(),countVal.end());
|
|
|
|
|
Thank you!
I am trying to do the following within a function if it is works:
//
for ( int i=0;i<nh;i++)
{
="" int="" n="d[i]/10;
" vector="" <float=""> z[n];
//
for ( int j=0;j<n;j++)
{
="" xc="10*j*" x[i]="" d[i];
="" yc="10*j*" y[i]="" z[j]="SEVAL3D(n_points," xc,yc,x_topo,="" y_topo,="" z_topo);
="" if(zmax<z[j])="" {zmax="z[j];
" imax="j;}
" }
please="" advise="" if="" i="" can="" use="" a="" vector="" in="" this="" way?
thanks
<div="" class="signature">modified on Thursday, March 25, 2010 1:37 PM
|
|
|
|
|
Check your posts after you've made them - some of it has gone missing:
mrby123 wrote: for ( int i=0;i
mrby123 wrote: for ( int j=0;j
Clearly these two lines are incomplete.
There are many problems with your code. For example, the following is illegal since n is computed at runtime (and your post doesn't show the template arguments):
mrby123 wrote: vector z[n];
Also what is d ? You don't use z ?
If you want help explain what you're trying to do in detail and take some care to make it readable.
Steve
|
|
|
|
|
I was happily coding away when I noticed that the compiler keeps recompiling way too many files.
So, I changed a single line in my code – using unassigned variable and guess what – it recompiled and given me no error - until I used “Rebuild all”.
This in no big deal, I can use “Rebuild all” all the time, but it is annoying.
I know sometime this happens when you change system time / date. But I did not touch anything in that area.
When I have a break in coding I am going to reload VC6.0 from scratch.
Is there any other, preferably easier way to convince the compiler to behave??
Please, no comments likes “old technology”, “upgrade” to VS 2xxx, .NET etc. are necessary!
Only constructive comments are welcome and as always appreciated.
Thanks for your time.
Vaclav
|
|
|
|
|
Try disabling precompiled headers (if you didn't try that yet).
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|