|
works perfectly!
|
|
|
|
|
Hi,
How can I make the edit control of a CRichEditView read-only? Setting ES_READONLY flag does the job but messes up at other places.
Thanks,
Krishnan
|
|
|
|
|
try this:
CRichEditCtrl &rich=GetRichEditCtrl();
rich.SetReadOnly(true);
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I found that the OLE DB provider for jet (aka access databases) does not correctly bind string columns to PropVariants. Upon return, the type is set "VT_BSTR", but the string is empty (but allocated).
Findings:
Jet 3.51: binds correctly to DBTYPE_BSTR, _VARIANT, _PROPVARIANT
Jet 4 SP3: binds correctly to DBTYPE_VARIANT, but not to DBTYPE_BSTR or DBTYPE_PROPVARIANT.
Anybody has an idea of an workaround?
Peter
|
|
|
|
|
One thing that came to mind was an old problem with Unicode and Jet. You had to use VT_BSTRT instead of VT_BSTR to get anything - VT_BSTR is Unicode and if ANSI is expected the string will be empty (or only contain one letter). However, I'm not sure this is the problem, and it doesn't give any explanation for the DBTYPE_PROPVARIANT thing.
Just my $0.02
Steen.
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
I have a CString ,and I want to put it (or convert it) into variant type.
What is the code?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here."Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
CString val("hi");
COleVariant var(val);
Joel Lucsy (jjlucsy@ameritech.net)
|
|
|
|
|
Thanks ,that's work.Now can you tell me how can I convert this
variant to CString or int or another type?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
CString var = "1.3";
COleVariant val( var );
var = V_BSTR( &val );
double junk = atof( var );
val.ChangeType( VT_R8 );
junk = val.dblVal;
Joel Lucsy (jjlucsy@ameritech.net)
|
|
|
|
|
thanks,I'll check it.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I compil on XP with VC++6 SP5 and it works on XP
...
Bitmap.LoadBitmap(IDB_BITMAP);
m_StaticBitmap.SetBitmap(Bitmap);
...
BUT, the bitmap doesn't show on 98 SE
WHY???
|
|
|
|
|
Is this bitmap of yours any rare? There are exceptional cases where a bitmap is correctly handled by NT/2000/XP and not by 98/ME (see MSDN info <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_1rw2.asp">BITMAPINFOHEADER</a> ). If you suspect this to be the case, try replacing IDB_BITMAP with any other, standard bitmap.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
On 98
m_StaticBitmap.RedrawWindow();
it's necessary,but not on XP
|
|
|
|
|
Simplest things often are the most elusive
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Can anyone tell me the main difference between class and structure.
Like class we can also inherit one structure from other.
Like class we can also add public/private/protected members in struct.
Like class we can also insert both data and functions in struct.
SO WHAT IS THE MAIN DIFFERENCE BETWEEN CLASS AND STRUCTURE ?????????
Samad khan
|
|
|
|
|
One defaults to private (class) and the other defaults to public (struct). Other than that, there is no difference at all.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I know the basic of this question is about VB but I figure I'm gonna have to use API to get what I want so I thought I'd post it here for the gurus to look at. Here goes...
How do you force a modal form to show up in the taskbar.
E.g.
You have a bog basic VB Form named Form1 and a Sub Main which looks like this.
Public Sub Main
Form1.Show vbModal
End Sub
The fact that the form is modal means that it doesn't show up on the taskbar. I need it to show up on the task bar. Any ideas? API Welcome!
Cheers
Pete
|
|
|
|
|
This is a VB answer.
A Form has a property called "ShowInTaskbar", set this to true and the form will appear in the taskbar
Michael
|
|
|
|
|
Close, but no cigar. This property is overridden for modal forms...
Pete
|
|
|
|
|
I think it's part of VB.
Modal windows are treated differently I guess.
You could do this though.
CreateWindow a window and move it out of the desktop in your modal form's load function.
Worth a try.
When the modal form closes, destroy the window you created.
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Originally I was thinking that if I need to catch special keys like F1, F2 etc using the OnCmdMsg in the App or MainFrame classes. I was not sure how the command routing occured if lets say a control had focus. And I still don't. I only see in MSDN how Frame, Views etc passes the messages. If someone can shed some light for me on this, I would appreciate it.
However, I was think that maybe a hook is what I need. Where would I put the SetwindowsHookEx if I want to do this? In the MainFrame or ??? Would I make the KeyboardProc a member callback function of the class also then so that I can have a handle or pointer to the class available to send it a message that this key is pressed.
Thank you.
|
|
|
|
|
Aren't accelerators fit for your purposes? I've created a small CFormView -based SDI app, added an accelerator for F1 along with an associated command handler in the CWinApp -derived class, and the thing works even if focus is on some of the controls of the view.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi all,
On loading, my app is displaying an error message to users using Win2K without admin/power user privelledges.
The error states it is unable to update the registry and suggests using regedit. The problem appears to be being caused by some code in InitInstance() which was generated by the VC MFC appwizard:
> // When a server application is launched stand-alone, it is a good idea
> // to update the system registry in case it has been damaged.
> m_server.UpdateRegistry(OAT_DISPATCH_OBJECT);
I'm presuming this is a permissions issue and a normal user has insufficient privelledges to write to the registy.
Suggestions anyone?
--
The Obliterator
|
|
|
|
|
Hi Obliterator
I'm having the same problem right now with my application. Since this message is posted in Feb 2002, did you found the solution for this?
Thanks,
Luis E.
Luis E. Cuadrado
)
|
|
|
|
|
Well it seems the call is somewhat superfluous - it certainly is not needed for my app. However to be on the safe side I determine if the user has admin rights - if so I call the function, otherwise I simply skip the call.
If its really important you could demand admin privelledges for installation and call the function at the time. See KB Q254957[^] for more info.
Hope it helps.
...
if(CUserInfo::isUserPrivilege(DOMAIN_ALIAS_RID_ADMINS))
m_server.UpdateRegistry(OAT_DISPATCH_OBJECT);
...
BOOL CUserInfo::isUserPrivilege(DWORD dwSubAuthority)
{
TOKEN_GROUPS* tgTokens;
DWORD group_no;
PSID admin_psid;
HANDLE hToken, hProcess;
hProcess = GetCurrentProcess();
ASSERT(hProcess);
if(hProcess)
{
OpenProcessToken(hProcess, TOKEN_QUERY, &hToken);
ASSERT(hToken);
if(hToken)
{
GetTokenInformation(hToken, TokenGroups, NULL,0, &group_no);
{
tgTokens = (TOKEN_GROUPS*)new BYTE[group_no];
GetTokenInformation(hToken, TokenGroups, tgTokens, group_no, &group_no);
{
SID_IDENTIFIER_AUTHORITY authsid = SECURITY_NT_AUTHORITY;
if(AllocateAndInitializeSid(&authsid, 2, SECURITY_BUILTIN_DOMAIN_RID,
dwSubAuthority,0,0,0,0,0,0, &admin_psid))
{
for (int i = 0; i < tgTokens->GroupCount; i++)
if (EqualSid(tgTokens->Groups[i].Sid, admin_psid))
{
delete [] tgTokens;
CloseHandle(hToken);
FreeSid(admin_psid);
return TRUE;
}
return FALSE;
}
}
}
}
}
return FALSE;
}
--
The Obliterator
|
|
|
|