|
Since I'm only using the CString as a read-only input, I think I don't have to release it.
anyway, I fixed this (see answer to Cédric).
Max,
Watched code never compiles.
|
|
|
|
|
It's a 'read-only' input now. What about tomorrow, and two years from now? If you'll have to change the code?
It's good practice to release the buffer.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Rajesh R Subramanian wrote: It's good practice to release the buffer.
It's even better practice not to call GetBuffer if you don't need to
|
|
|
|
|
Exactly, which I mentioned clearly in my previous post.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Rajesh R Subramanian wrote: you MUST call CString::ReleaseBuffer().
Only if you change the length of the string.
|
|
|
|
|
I have added a EditBox control to a Dialog and i have selected the property(number : true,VC++ 2005). i have validated, only number can be entered.if user enters characters it will not accept,ok it works fine.But when user copy some text and paste in EditBox it is accepting i am getting strange output. please help how to stop copy and paste text or any character in EditBox .
|
|
|
|
|
For that you need to implement your own EditBox, like the example given ( Create your own controls - the art of subclassing[^])
And inside which you u have overiride the PreTranslateMessage.
eg:-
BOOL MyEditCtrl::PreTranslateMessage(MSG* pMsg)
{
switch( pMsg->message )
{
case WM_KEYDOWN:
{
switch( pMsg->wParam )
{
case 0x56:
{
if( GetKeyState(VK_CONTROL) )
return true;
}
break;
}
}
break;
case WM_RBUTTONDOWN:
{
return true;
}
break;
}
return CMyEdit::PreTranslateMessage(pMsg);
}
Величие не Бога может быть недооценена.
|
|
|
|
|
|
Hi All
I am using Report View in List control with 5 to 6 columns.
I need to transfer thes data from each column to excel sheet.
Any Way to do it ??
Regards
Gany
|
|
|
|
|
|
Or , you can look over here , I was used this class and work fine !
|
|
|
|
|
Apart from what was already suggested to you, you could consider exporting the values in .CSV format which Excel also can read and is more portable.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
csv is a more generic format than xls([^])
Величие не Бога может быть недооценена.
|
|
|
|
|
Adam Roderick J 09 wrote: csv is a more generic format than xls
Yes , you are perfectly right , is much more handly and simple to export data in .csv format then .xls ! I recommend this solution !
|
|
|
|
|
i am using Vertical Scrollbar to the dialog window, when i scroll down with controls it works fine,but i want to reposition my dialog along with vertical scroll bar dynamically.i will reset the Vertical Scrollbar.but dialog remains unchanged.i want dailog to refresh.
eg:
SCROLLINFO si;
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_ALL;
si.nMin = 0;
si.nMax = 200;
si.nPage = 0;
si.nPos = 0;
SetScrollInfo(SB_VERT, &si, TRUE);
|
|
|
|
|
I think you may need to use InvalidateRect() [^] to tell the dialog that it needs repainting.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Hi,
My application reads data at startup from the registry.
By default it always goes to HKEY_CURRENT_USER in the registry, but I would like it to use HKEY_LOCAL_MACHINE.
I know I can use RegQueryValueEx and specify HKLM, but I was wondering if there is a way to set the root to be HKLM instead of HKEY_CURRENT_USER, and therefore when I call
SetRegistryKey(_T("Company\\App"));
the root will be HKLM instead of HKEY_CURRENT_USER.
TIA
Tony
|
|
|
|
|
From within the CWinApp derived class change the value of the variable m_pszRegistryKey .
Allocate the string on the heap because the CWinApp destructor calls free on this variable.
The recommended way of doing this is -
m_pszRegistryKey = _tcsdup(_T("HKEY_LOCAL_MACHINE\\Software\\Company\\App"));
You will need administrative privileges to make this happen.
|
|
|
|
|
Thanks for that,
The problem I am going to encounter then is that most users of my application will not have administrative privileges and therefore won't get that level of access.
I'll have to do a code rejig and use the RegQueryValueEx functionality instead.
Thanks
Tony
|
|
|
|
|
If you want to write to HKEY_LOCAL_MACHINE you will anyway need administrator privileges.
If not it will be written to a key inside HKEY_CURRENT_USER .
|
|
|
|
|
Forgive me if I'm being thick...
In VC6, I could use the Debugger Remote Connection, compile to a network share, and then when I press F5, it would run my program on the remote computer, and attach msvcmon to it. I could make break points, and all was good and simple. The only issue was to make sure the clocks agreed.
I'm trying to do the same in VS2008, and failing...
I can find how tos on attaching to a remote process, but then I can't put a breakpoint in my code.
If anyone can give me pointers, I'm sure I'm missing out on one obvious step.
Thanks,
Iain.
I have now moved to Sweden for love (awwww).
|
|
|
|
|
What sort of issues are you having? The breakpoints are not hit?
When it's simple, I usually compile the binaries to the network drive directly and like you said, if I press F5, it loads it from the network and breakpoints will be hit.
If it's something more complex like an ISAPI DLL that would be loaded by IIS on a remote server, then I attach my debugger to the remote process (inetinfo.exe on the server in this case) and when I load the web page, my break points will be hit (of course given I've copied the DLL to the remote machine).
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Rajesh R Subramanian wrote: What sort of issues are you having?
I can;t find any way of pressing f5 on one machine, and have the program run on another machine (one with msvcmon.exe running on it).
If I run it manually on the remote machine, and attach from my local machine, the any attempt to put a breakpoint in my code gets a white circle with a warning. And that's on code I breakpointed locally not long before.
As I said, I'm probably just missing one setting somewhere, and will feel silly afterwards!
Iain.
I have now moved to Sweden for love (awwww).
|
|
|
|
|
in the project settings -> Debugging -> Remote Debugger (Listbox above the list options)
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Thanks Karsten, this looks exactly like what I was missing.
Sadly, it's not playing well over my long vpn link with different domains and users at each end - But it's a reason to make a VM locally and play again.
Thanks,
Iain.
I have now moved to Sweden for love (awwww).
|
|
|
|