| How to loadImage from resource |
|
 |
Index ‹ Visual Studio ‹ Visual Studio C++
|
- Previous
- 1
- MFC >> Resizing an applicationHello,
I want to put a limit on the minimum size that my application can be resized
to. Any ideas on how to implement this?
- 2
- Visual Studio C++ >> question on __based pointers (VC 7.1)This is a multi-part message in MIME format.
------=_NextPart_000_000D_01C4CB56.771AAF40
Content-Type: text/plain;
charset="koi8-r"
Content-Transfer-Encoding: quoted-printable
Hi,
I cannot understand compiler's logic when compiling the following code:
void test()
{
void *b;
char __based(b) *p;
long v;
//++ case 1=20
char *temp =3D (char*)p;
v =3D (long)temp;
//--
//++ case 2
v =3D (long)(char*)p;
//--
}
Why in case 1 l gets a value different than in case 2 ?
Here is corresponding excerpt from .asm file generated during =
compilation (optimization disabled):
_l$ =3D -16 ; size =3D 4
_b$ =3D -12 ; size =3D 4
_pc$ =3D -8 ; size =3D 4
_p$ =3D -4 ; size =3D 4
?test@@YAXXZ PROC NEAR ; test
; 2 : {
push ebp
mov ebp, esp
sub esp, 16 ; 00000010H
; 3 : void *b;
; 4 : char __based(b) *p;
; 5 : =20
; 6 : long v;
; 7 : =20
; 8 : //++ case 1=20
; 9 : char *temp =3D (char*)p;
mov eax, DWORD PTR _p$[ebp]
add eax, DWORD PTR _b$[ebp]
mov DWORD PTR _temp$[ebp], eax
; 10 : v =3D (long)temp;
mov ecx, DWORD PTR _temp$[ebp]
mov DWORD PTR _v$[ebp], ecx
; 11 : //--
; 12 :=20
; 13 : //++ case 2
; 14 : v =3D (long)(char*)p;
mov edx, DWORD PTR _p$[ebp]
mov DWORD PTR _v$[ebp], edx
; 15 : //--
; 16 : } mov esp, ebp
pop ebp
ret 0
?test@@YAXXZ ENDP ; test
Thanks in advance.
---
Best regards
R. Green
------=_NextPart_000_000D_01C4CB56.771AAF40
Content-Type: text/html;
charset="koi8-r"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dkoi8-r">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff background=3D"">
<DIV><FONT face=3DArial size=3D2>Hi,<BR><BR>I cannot understand =
compiler's logic=20
when compiling the following code:<BR><FONT face=3DCourier =
size=3D2><FONT=20
face=3DArial><FONT color=3D#0000ff size=3D2>
<P><FONT face=3D"Courier New">void</FONT></FONT><FONT size=3D2><FONT=20
face=3D"Courier New"> test()</FONT></P>
<P><FONT face=3D"Courier New">{</FONT></P>
<P></FONT><FONT face=3D"Courier New" color=3D#0000ff =
size=3D2>void</FONT><FONT=20
size=3D2><FONT face=3D"Courier New"> *b;</FONT></P>
<P></FONT><FONT face=3D"Courier New"><FONT color=3D#0000ff =
size=3D2>char</FONT><FONT=20
size=3D2> </FONT><FONT color=3D#0000ff =
size=3D2>__based</FONT></FONT><FONT=20
size=3D2><FONT face=3D"Courier New">(b) *p;</FONT></P>
<P><FONT face=3D"Courier New"></FONT></P>
<P></FONT><FONT face=3D"Courier New" color=3D#0000ff =
size=3D2>long</FONT><FONT=20
size=3D2><FONT face=3D"Courier New"> v;</FONT></P>
<P><FONT face=3D"Courier New"></FONT></P>
<P></FONT><FONT color=3D#008000 size=3D2><FONT face=3D"Courier New">//++ =
case 1=20
</FONT></P></FONT><FONT size=3D2>
<P></FONT><FONT face=3D"Courier New"><FONT color=3D#0000ff =
size=3D2>char</FONT><FONT=20
size=3D2> *temp =3D (</FONT><FONT color=3D#0000ff =
size=3D2>char</FONT></FONT><FONT=20
size=3D2><FONT face=3D"Courier New">*)p;</FONT></P>
<P><FONT face=3D"Courier New">v =3D (</FONT></FONT><FONT face=3D"Courier =
New"=20
color=3D#0000ff size=3D2>long</FONT><FONT size=3D2><FONT=20
face=3D"Courier New">)temp;</FONT></P>
<P></FONT><FONT color=3D#008000 size=3D2><FONT=20
face=3D"Courier New">//--</FONT></P></FONT><FONT size=3D2>
<P></FONT><FONT color=3D#008000 size=3D2><FONT face=3D"Courier New">//++ =
case=20
2</FONT></P></FONT><FONT size=3D2>
<P><FONT face=3D"Courier New">v =3D (</FONT></FONT><FONT face=3D"Courier =
New"><FONT=20
color=3D#0000ff size=3D2>long</FONT><FONT size=3D2>)(</FONT><FONT =
color=3D#0000ff=20
size=3D2>char</FONT></FONT><FONT size=3D2><FONT face=3D"Courier =
New">*)p;</FONT></P>
<P></FONT><FONT color=3D#008000 size=3D2><FONT=20
face=3D"Courier New">//--</FONT></P></FONT><FONT size=3D2>
<P><FONT face=3D"Courier New">}</FONT></P>
<P> </P></FONT></FONT></FONT>
<P><FONT face=3DCourier size=3D2><FONT face=3DArial><STRONG>Why in case =
1 <FONT=20
face=3DCourier>l</FONT> gets a value different than in case 2=20
?</STRONG></FONT></FONT></P>
<P><FONT face=3DCourier size=3D2> </P></FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT color=3D#0000ff size=3D2><FONT =
face=3DCourier><FONT=20
size=3D2>
<P></FONT></FONT></FONT>Here is corresponding excerpt from .asm file =
generated=20
during compilation (optimization disabled):<BR><BR><BR><FONT =
face=3DCourier>_l$ =3D=20
-16 ; size =3D 4<BR>_b$ =3D=20
-12 ; size =3D 4<BR>_pc$ =3D=20
-8 ; size =3D 4<BR>_p$ =3D=20
-4 ; size =3D 4<BR>?test@@YAXXZ PROC=20
NEAR ; test<BR><BR></FONT></P>
<P><FONT face=3DCourier>; 2 : {</FONT></P>
<P><FONT face=3DCourier> push ebp<BR> mov ebp,=20
esp<BR> sub esp, 16 ;=20
00000010H</FONT></P>
<P><FONT face=3DCourier>; 3 : void *b;<BR>;=20
4 : char __based(b) *p;<BR>; 5 =
:=20
<BR>; 6 : long v;<BR>; 7 =
:=20
<BR>; 8 : //++ case 1 <BR>; =
9 :=20
char *temp =3D (char*)p;</FONT></P>
<P><FONT face=3DCourier> mov eax, DWORD PTR=20
_p$[ebp]<BR> add eax, DWORD PTR =
_b$[ebp]<BR> mov DWORD PTR=20
_temp$[ebp], eax</FONT></P>
<P><FONT face=3DCourier>; 10 : v =3D =
(long)temp;</FONT></P>
<P><FONT face=3DCourier> mov ecx, DWORD PTR=20
_temp$[ebp]<BR> mov DWORD PTR _v$[ebp], ecx</FONT></P>
<P><FONT face=3DCourier>; 11 : //--<BR>; =
12 : <BR>;=20
13 : //++ case 2<BR>; 14 : v =3D=20
(long)(char*)p;</FONT></P>
<P><FONT face=3DCourier> mov edx, DWORD PTR=20
_p$[ebp]<BR> mov DWORD PTR _v$[ebp], edx</FONT></P>
<P><FONT face=3DCourier>; 15 : //--<BR>; =
16 :=20
} mov esp, ebp<BR> pop ebp<BR> ret 0<BR>?test@@YAXXZ=20
ENDP ; test</FONT></P>
<P><FONT face=3DCourier></FONT> </P>
<P><STRONG></STRONG> </P>
<P><STRONG></STRONG> </P>
<P><STRONG>Thanks in advance.</STRONG></P>
<P>---</P>
<P> </P>
<P>Best regards</P>
<P> </P>
<P>R. Green</P>
<P> </P>
<P><FONT face=3DCourier></FONT></FONT> </P></DIV></BODY></HTML>
------=_NextPart_000_000D_01C4CB56.771AAF40--
- 3
- Visual Basic [VB] >> CanBeDone: unmanaged IntPtr to Delegate?Hello:
I am trying to write a wrapper for the WabApi (wich manages the Windows
Adress Book).
It uses some "kind of" interfaces, like IWABObject. But these interfaces
dont have Guids, and QueryInterface fails.
So I am thinking of getting the VTable and calling its methods.
I allready have the Vtable wich is something like this:
public structure IWABObjectVtbl
QueryInterface as IntPtr
etc.
...
end structure
The question is How can i cast the IntPtr to a delegate so I can call the
method?
Thanks a lot!!
Alejandro Lapeyre
- 4
- MFC >> VC++ 5 Q. - Shared DLL vs. statically linked lib?When I say VC++ 5 - I mean it. I don't mean Visual Studio 2005. This is
Visual Studio 97 or something. So cast your mind back.
I use the MFC. When given the choice of having a statically linked lib or
using a shared DLL, for the MFC library, I have always up to now used a
shared DLL for my standalone app - based mainly on a vague feeling that it
might load faster (or already be loaded), and use less memory. But I have
finally had one user who has a problem that I believe is based on his having
an updated MFC DLL (i.e. a "DLL Hell" problem).
I presume there are 3 options available to me (for the future):
(a) Continue as now - use a shared DLL, properly installed, and don't worry
about it
(b) Use a static lib
(c) Use the shared DLL for the MFC but put the MFC dll in my app's
directory, with a file that has the same name as my app, but with a .local
suffix - e.g. "MyApp.exe.local" (i.e. use "DLL/COM" Redirection).
Anyone got any suggestions about the relative merits of these options?
Thanks in advance.
Simon
P.S. I'm hoping to upgrade to VC++ 6 any year now. S.
- 5
- Visual Basic [VB] >> Another Printing QuestionHi,
I am currently testing the printing features of Visual Studio 2005 (VB.NET)
We want to release a database application that prints label pages. The
labels must contain a picture box.
I found this code to print an image:
e.Graphics.DrawImage(Image.FromFile("c:\\dev\\Projects\\Impression\\merci.png"),
20, 750)
With this code, the picture will print with its original dimensions. Is it
possible to change this line with a picturebox or any control that allows us
to resize the image (and keep its proportions) within a limited space?
Thanks in advance!
ANNE DEBLOIS
- 6
- VB Scripts >> Update local user password via GPO or script.Hello all â??
I have a script to update an AD users password via script but am wondering
if it is possible to update a local users password via script or GPO. Iâ??d
post the script I have but itâ??s just from the portable script center.
Thanks for your assistance.
TimM
- 7
- MFC >> CScrollView questionI have created a window derived from CScrollView. When the logical view is
larger then the display view, I get both horiz and vert scroll bars. The
scrolling works fine with the scroll bars.
I want to programatically controll the scrolling so how can I make the
scroll bars disappear and still have the scrolling functionality?
In other words, I want to access to the scroll bars in CScrollView and hide
them with ShowWindow(SW_HIDE), and then still be able to scroll by sending
scroll messages programatically. Is this possible?
Thanks in advance.
Aeshkar
- 8
- MFC >> z-order in dialog editorHi,
I'm getting entirely frustrated in attempting to layout a dialog and
manipulate the controls. I'm using MFC in VS2003. There doesn't appear to
be any ability within the Format menu to manipulate the z-order of the
controls on the dialog. I went into the "Customize..." dialog and found
"Bring to Front" and "Send to Back" under the Format menu. I added these to
my Format toolbar thinking that I had solved the problem. So what happened?
Nothing! I select a control and the "Bring to Front" and "Send to Back"
toolbar buttons never become enabled. I cannot figure out what to do to get
them enabled. So, if they're not there for dialog controls, what in the heck
are they for in the IDE? Sorry for the tone... but I am entirely frustrated
and hoping that I am just overlooking something. I'm really hoping that
someone can point me in the right direction.
--
Thanks in advance for your help,
Manny
- 9
- Visual Basic [VB] >> Reading Excel into a dataset in VB.netI haven't been able to configure a data adapter with the
wizard for Excel (Access is no problem) and when I try to
do it in code I still have problems, can anyone help,
here is some code I've been experimenting with.
Sub test()
Dim DS As System.Data.DataSet
Dim MyCommand As
System.Data.OleDb.OleDbDataAdapter
Dim MyConnection As
System.Data.OleDb.OleDbConnection
Dim datagrid1 As DataGrid
MyConnection = New
System.Data.OleDb.OleDbConnection( _
"provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=C:\Documents and
Settings\default\My Documents\Payroll.XLS; " & _
"Extended Properties=Excel 8.0;")
MyCommand = New System.Data.OleDb.OleDbDataAdapter
( _
"select * from [Sheet4$]", MyConnection)
DS = New System.Data.DataSet
MyCommand.Fill(DS)
datagrid1.SetDataBinding(DS, "sheet4$")
MyConnection.Close()
End Sub
Your help is greatly appreciated, Nitromuse
- 10
- Visual Basic [VB] >> VB.NET Form DesignerI have VB.NET project with multiple forms. I can view and work woth all forms in the project in normal design mode on one machine but not on another. Both instances of Visual Studion are accessing thr same source code; both are 2003 version.
The project executes OK on both systems and I can see the code for all forms on both machines. But on one machine I get an "object reference not set to an instance of an object" message when I attempt to see the form's design/layout.
--
Al S
- 11
- 12
- 13
- Visual Basic >> container namehow do i get the container name and it's position in a control array? for
example, cmdNext.Container.Name will return "PageNumber", but i would like
to get the control "PageNumber"'s position in the array. i just want to
check and see that each field is filled on a wizard page before enable the
next button. i need to do this for a couple of pages, not all of them,
which is why i'd like to get the container's position in the array.
thanks,
lance
- 14
- Visual Studio C++ >> Why won't this compile?This compiles in gcc but not on vc++
Error message is something like....
structs.h(171) : error C2440: 'initializing' : cannot convert from 'class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >' to 'atype'
typedef struct
{
string a;
string b;
} atype;
string ABC = ("123");
string DEF = ("456");
atype mylist[] =
{
{"ABC", ABC},
{"DEF", DEF}
};
- 15
- Visual Basic >> Error 70-Permission Denied accessing mdb file on Vista ComputerThe whole story.
I just upgraded from VB4 to VB5 on my Windows XP
computer with 500megs of RAM. When I run the VB5 Application setup Wizard
to create my distribution file (of a program that has run for years in VB4),
several unusal things happen.
First, in the first step of the wizard, if I check "Rebuild the Project" the
system hangs up until I go into task manager and stop the VB5 Wizard.
Second, the Wizard lists 4 files with no dependencies(urlmon.dll,
comdlg32.ocx, comctl32.ocx and shdocvw.dll) which I ignored.
Third, the Wizard notifies me that a dependency file for Crystl32.ocx is out
of date, which I ignored.
The Application setup then completes with my distribution File(program).
When I load my distribution file(executable program) onto a Vista Computer
with 2Gigs of memory, I get a message "an error occurred while registering
the file C\ProgramFile\Microsoft Shared\DAO\DAO350.dll" (which I ignored). I
also get the same message for the Shadocvw.dll ( which I ignored). Setup
then completes.
Now comes the problem. When I try to run my application on this Vista
computer, at the point that my program tries to open one of my data
files(microsoft Access .mdb files) I get "Runtime Error 70 - Permission
denied".
I tried changing the security settings on the folders and files to no avail.
My guess is that since the DAO350.dll did not register, this might be the
cause of my problem, but I don't know what to do about it.
The only thing I see suspicious is in checking the VB5Dep.ini file, the
Register=$(dllSelfRegister) line for the DAO350.dll is in line number 5;
instead of line number 1 as for the DAO3032.dll in VB4.
Now, I would like your verdict!! Thanks for the help.
|
| Author |
Message |
MarkRendle

|
Visual Studio C++ >> How to loadImage from resource
I tried to do it like this, but this is wrong.
HBITMAP hBmp = (HBITMAP)::LoadImage(
NULL,
szFilename,
MAKEINTRESOURCE(IDB_BITMAP1), \\<-here doesn't
works
0,
0,
LR_LOADFROMFILE|LR_CREATEDIBSECTION
);
Visual Studio77
|
| |
|
| |
 |
| |
 |
Index ‹ Visual Studio ‹ Visual Studio C++ |
- Next
- 1
- Visual Basic [VB] >> Saving settingsHi,
is it possible to access the properties of a class or structure in a for
each statement?
I want to iterate through the stirng properties in my class or structure and
then write them away to the config file.
thanks for your help in advance
--
--
TimB
- 2
- Visual Basic [VB] >> Changing Printer's default paperHi all,
I am trying to print a report in A4 paper, but my printer's default paper is
different (Letter 8.5 x 11 inches). So when i print, a significant part of
the paper remains blank, because of the different margins. Does anyone know
how to programmatically change the printer's default paper? Almost all
properties of the Printersettings Class on this matter are ReadOnly.
Thank u
Panos
- 3
- Visual Basic [VB] >> Make background of graphics object transparent.I keep getting my string inside a black box with this code.
I would like to make the background transparent. Any help on this will
be appreciated very much.
'**** BEGIN CODE ****
Try
Dim NewFont As New Font(fg.Font.FontFamily, 10, FontStyle.Regular)
Dim g As Graphics
Dim pic As Bitmap = New Bitmap(20, 20,
imaging.PixelFormat.Format24bppRgb)
g = Graphics.FromImage(pic)
g.Clear(Color.Transparent)
g.DrawString("H", NewFont, Brushes.Blue, 0, 0)
Dim st As New System.IO.MemoryStream
pic.Save(st, System.Drawing.Imaging.ImageFormat.Bmp)
Dim img As Image = Image.FromStream(st)
pct.Image = img
Catch exc As Exception
Stop
End Try
'**** END CODE ****
Kalvin
- 4
- VB Scripts >> Use AutoItX? maybe AutXtra then?I moderate http://groups.yahoo.com/group/AutoItList/ and I have
created AutXtra.exe http://groups.yahoo.com/group/AutoItList/files/UTIL/AutXtra2.zip
There are 60 odd functions in AutXtra.exe and they can be accessed via
WSH this way...(examples...assume AutXtra.exe is at c:\)
example1:
Set oAutoIt = CreateObject("AutoItX.Control")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objEnv = WshShell.Environment("process")
objEnv("autxtra") = "cdlist"
Set oExec = WshShell.Exec("c:\autxtra.exe *clipboard")
Do While oExec.Status = 0
WScript.Sleep 50
Loop
WScript.Echo oAutoIt.ClipGet()
example2:
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objEnv = WshShell.Environment("process")
objEnv("autxtra") = "cdopen"
objEnv("ax_drive") = "d:"
Set oExec = WshShell.Exec("c:\autxtra.exe *clipboard")
More Commands...
Commands:
-------------
Browse4Folder
CDClose
CDList
CDOpen
ChildClassList
DateAheadAgo
DiskSpace
DownLoad
DisableControl
EnableControl
FileDeleteLine
FileInsertLine
FileReplaceAll
FileReplaceLine
FindInFile (StringInFile)
FindPixel
FocusControl
Get8Dot3
GetComputerName
GetControlStats
GetCursor
GetFileSize
GetFileTime (GetFileDate)
GetLongFileName
GetPixelColor
HideControl
IsAdmin
LowerCase
MoveControl
MyIP
OpenDialog
Play
RemovableList
SaveDialog
ScreenSaverOff
ScreenSaverOn
SendToControl
SendToControlByClass
SetComputerName
ShortCut
ShowControl
StringAnsi2Oem
StringOem2Ansi
StringReplaceAll
StringReverse
TitleCase
UpdateEnv
UpperCase
WallPaper
WinBack
WinGetAllText (WinGetText)
WinGetStats
WinGetTextByClass
WinGetTitle
WinGetVisibleText
WinListAll
WinListVisible
WinNoTopMost
WinSetText
WinSetTextByClass
WinTopMost
--------------
- 5
- MFC >> what am i looking for?Hi. I am working on an MDI application and I am having problems looking for
information. I know what I want, I just dont know exactly what it is
called. When you start an MDI application and build and run it you get a
single document window in the main window. This is right, but I want a bar
docked to the left side of the main window that has a CTreeView control,
much like the folders bar that the Windows explorer has. I started looking
into the CSplitterWnd class which made the left tree like I wanted, but the
right frame looks like I cannot have multiple child windows in it anymore.
The ControlBar looks promising, but I'm not sure how to set it up. Would I
want a DialogBar in it, and if so, would I need a CTreeCtrl instead of
CTreeView? I have done several dialog based mfc applications before, but
SDI/MDI is new to me. Any help is appreciated. Thanx.
jorj
- 6
- 7
- Visual Basic [VB] >> How to display username of visitor to pageI would like to display the username of the visitor top a web page. This is
assuming that the visitor is coming from within a winodws2000 Domain. I
have tried the following but it gives me the user ASPNET which I assume is
coming from the IIS server not the web client :
Imports System.Security.Principal
'Returns current user
Public Function CurrentUser()
Dim pos As Integer, fullname As String
fullname = System.Security.Principal.WindowsIdentity.GetCurrent().Name
'Just to get at the username after the 'domainname\' Should really use
Substring instead of Mid
pos = InStr(fullname, "\", CompareMethod.Text)
CurrentUser =
Mid(System.Security.Principal.WindowsIdentity.GetCurrent().Name, pos + 1)
End Function
'To test whether user is a member of a group
Private Function InGroup(ByVal grp As String) As Boolean
Dim id As WindowsIdentity
id = WindowsIdentity.GetCurrent()
Dim p As New WindowsPrincipal(id)
InGroup = p.IsInRole("YourDomainName\" + grp)
End Function
....and a sample Sub Main()....
Sub Main()
dim msg as string
If InGroup("AppUsers") Then
Application.Run(New YourMainForm)
Else
msg = "You are not a registered user. Please go away."
MessageBox.Show(msg, "Invalid user", MessageBoxButtons.OK)
End If
End Sub
- 8
- VB Scripts >> Remotable WSC not showing up in "dcomcnfg.exe" ?Hi there,
maybe someone could help me in this corner:
- I created a WSC (a COM component with the logic written in VBasic and ooRexx), which can be
instantiated locally *and* after some research and peeking and poking also remotely (one needs to
use the "remotable"-attribute and then configure the remote access via "dcomcnfg.exe"
- after enhancinge, changing, copying forward and backward, renamed the PROGID and the like; anyway,
locally everything has been working and humming along nicely, but now when trying to test the
remote-instantiation and remote access I need to configure the DCOM part for that WSC; unexplicably,
the WSC-component does not show up anymore? Tried a lot of things (including rebooting the machine a
couple of times just to be sure), but so far I could not come to a solution.
If there is anyone who could give any hints/ideas, I really would appreciate it.
TIA,
---rony
P.S.: Could it be that NTFS-access rights can have an influence on "dcomcnfg.exe" not being able to
find my WSC-component ? (To fight that, I allowed full access to "Everyone" on that particular
directory tree, but who knows?)
- 9
- MFC >> NetUserSetInfo() HomepathChecked w/VS 6.0 SP6 & .Net & .Net 2003
With NetUserSetInfo() when I set Home Folder Connect, the function works
fine. When I check it from the user manager, the home folder connect letter
and path is also seen. But when the user logs it's does not connect to home
folder. However if I click the edit field and <APPLY> from Windows User
Manager the next logon it connects home folder. Windows 2000 doesn't give any
message but in WServer 2003 prompts a dialog already....
Is it a program mistake or < Windows XP & SP2, Windows 2000, Windows Server
2003 > problem.
ui.usri1053_home_dir_drive = L"U";
ur.usri1006_home_dir = m_homepath;
nStatus = NetUserSetInfo(NULL, m_lpuser, dwLevel, (LPBYTE)&ui, NULL);
NetUserSetInfo(NULL, m_lpuser, dwLevel1, (LPBYTE)&ur, NULL);
- 10
- Visual Basic >> Problem in Binary To Double Conversion in Win2000 which is working fine in WinXPHai,
I am trying to convert a binary value to double using the function
'pblfBinaryToDouble' given below. I am getting the result correctly in
Windows XP, but an 'Overflow Error' in Windows 2000. Can any one please help
me to solve this problem? What may be the issue, should I run any service
pack in Windows 2000 or something else?
The problem I am facing is in:
Microsoft Windows 2000
5.00.2195
Service Pack 4
Microsoft VisualBasic 6.0
Sample Output which I am getting in WindowsXP:
x = chr(0) & chr(0) & chr(182) & chr(69) & chr(102) &chr(102) & chr(6) &
chr(160)
?x
¶Eff
?pblfBinaryToDouble(x)
200409186961056
The functions used are given below.
Thanks & Regards,
Uma
Public Function pblfTwiddle(ByVal svInput As String) As String
Dim lngCount As Long
Dim svResult As String
svResult = ""
pblfTwiddle = svResult
For lngCount = Len(svInput) To 1 Step -1
svResult = svResult + Mid(svInput, lngCount, 1)
Next
pblfTwiddle = svResult
End Function
Public Function pblfBinaryToDouble(ByVal svBinaryValue As String) As Double
Dim lngLength As Long
Dim lngCount As Long
Dim svHex As String
Dim dblResult As Double
dblResult = 0#
pblfBinaryToDouble = dblResult
svBinaryValue = pblfTwiddle(svBinaryValue)
lngLength = Len(svBinaryValue)
svHex = "&H"
For lngCount = lngLength To 1 Step -1
svHex = svHex & IIf(Len(Hex(Asc(Mid(svBinaryValue, lngCount, 1)))) =
1, "0", "") & Hex(Asc(Mid(svBinaryValue, lngCount, 1)))
Next lngCount
dblResult = CDbl(svHex)
pblfBinaryToDouble = dblResult
End Function
- 11
- 12
- VB Scripts >> MS Word TAB jumpingI'm making a vbs script that opens a .DOT word document, saves a .DOC
copy, and then modifies the .DOC's content.
The document contains several Text Form Fields. I want the script to
write a string in each of those Fields. How do I enumerate the fields
(jump from one field to the next)?
--
Regards,
Thomas M.
- 13
- VB Scripts >> Eventlogs Related QuestionMoved here from inetsdk.programming.scripting.vbscript
upon the suggestion of Bob Barrows.
-----
A rather odd set of eventlog questions:
This isn't limited directly to *servers* but is applicable to
them. As I'm certain most of you know, you can create your own
personal "eventlog" and then write your error messages to it.
(The means to do so is clearly outlined on the MS scripting
site.)
Unfortunately, beyond those two steps there is lot that is
left to the imagination not only with regard to the personal
eventlog but also to the normal OS eventlogs. For example:
When one creates an eventlog, how can be certain that it was
successfully created? Assuming that you were successful in
creating the eventlog how can you later check to determine
whether it exists or not? (This question could also apply to
any/all of the usual OS eventlogs as well. [You wouldn't
want to write unless it existed.])
When you try to write a message to/into the/any eventlog, how
can you be certain that the attempt was successful? (Again
this could also be said for the standard OS eventlogs as
well.) [If the attempt failed you might want to write a
failure message into one of the OS eventlogs.]
I suspect that the standard answer will be "by clearing and
then checking the value of *error*" which makes sense, but
of course requires some knowledge of what you're looking
for in advance, which I don't, and which has resulted in
this post.
Does anyone out there have any experience that might be
able to elucidate/illuminate what I might be looking for?
Many thanks in advance.
David
- 14
- Visual Studio C++ >> CString::AllocSysString() needs to be free'd?Hello!
I'm using VC++ 7.0 (.net 2002) and MFC.
I have a function (foo) that uses a CString variable (strCommand) as a
parameter. foo is accessing a database via ADO. Among the code is this:
pCommand->put_CommandText(strCommand.AllocSysString());
Do I need to free the memory allocated to string or will it do so
automatically?
// Anders
Crossposted to: microsoft.public.dotnet.languages.vc,microsoft.public.vc.language,microsoft.public.vc.mfc
Replies will go to: microsoft.public.dotnet.languages.vc
- 15
- Visual Basic [VB] >> Importing Excel into Access with VBI need some code ideas to import Excel into Access using
VB. I need to use VB because the Excel column formats are
not always consistent.
I'm importing a fairly simple spreadsheet.
Any assistance would be greatly appreciated.
|
|
|