Empty manifest file
In a build of a service COM module, the following error are generated during
linking:
...
Linking...
LIBCMT.lib(ftol2.obj) : error LNK2005: __ftol2 already defined in
WMStubDRM_34119.lib(ftol2.obj)
MSVCRT.lib(MSVCR80.dll) : error LNK2005: _free already defined in
LIBCMT.lib(free.obj)
MSVCRT.lib(MSVCR80.dll) : error LNK2005: _malloc already defined in
LIBCMT.lib(malloc.obj)
MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall
type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z)
already defined in LIBCMT.lib(typinfo.obj)
MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info &
__thiscall type_info::operator=(class type_info const &)"
(??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other
libs; use /NODEFAULTLIB:library
..\..\bin\MyService.exe : fatal error LNK1169: one or more multiply defined
symbols found
Then I added the Command Line option, "/FORCE", the service module finishes
it linking (and the service can be started manually), but gives the warnings:
...
Generating Code...
Linking...
LIBCMT.lib(ftol2.obj) : warning LNK4006: __ftol2 already defined in
WMStubDRM_34119.lib(ftol2.obj); second definition ignored
MSVCRT.lib(MSVCR80.dll) : warning LNK4006: _free already defined in
LIBCMT.lib(free.obj); second definition ignored
MSVCRT.lib(MSVCR80.dll) : warning LNK4006: _malloc already defined in
LIBCMT.lib(malloc.obj); second definition ignored
MSVCRT.lib(ti_inst.obj) : warning LNK4006: "private: __thiscall
type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z)
already defined in LIBCMT.lib(typinfo.obj); second definition ignored
MSVCRT.lib(ti_inst.obj) : warning LNK4006: "private: class type_info &
__thiscall type_info::operator=(class type_info const &)"
(??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj);
second definition ignored
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other
libs; use /NODEFAULTLIB:library
..\..\bin\MyService.exe : warning LNK4088: image being generated due to
/FORCE option; image may not run
WMStubDRM_34119.lib(gs_support.obj) : warning LNK4254: section '.CRT'
(40000040) merged into '.data' (C0000040) with different attributes
LIBCMT.lib(crt0init.obj) : warning LNK4253: section '.CRT' not merged into
'.rdata'; already merged into '.data'
Embedding manifest...
...
In both above cases, the generated manifest file is empty with no dependancy
info contained at all, as below:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
</assembly>
Do some people know what's cause of the problem?
Thanks,
DH Tag: SSH connections Tag: 265123
CCcomBSTR to vector<DWORD>
hi
[VC++ 6]
I receive values from an another application as a com string:
"234,454,567,5676756, etc... "
And i need to store the values as DWORDs in an array,
preferably a vector<DWORD> .
What would be the faster way of doing this ?
thank you Tag: SSH connections Tag: 265122
static library
Error 1 error LNK2005: _printf already defined in
libcmtd.lib(printf.obj) MSVCRTD.lib
Error 2 error LNK2005: _free already defined in
libcmtd.lib(dbgheap.obj) MSVCRTD.lib
Error 3 error LNK2005: _malloc already defined in
libcmtd.lib(dbgheap.obj) MSVCRTD.lib
Error 4 error LNK2005: "private: __thiscall
type_info::type_info(class
type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in
libcmtd.lib(typinfo.obj) MSVCRTD.lib
Error 5 error LNK2005: "private: class type_info & __thiscall
type_info::operator=3D(class type_info const &)"
(??4type_info@@AAEAAV0@ABV0@@Z) already defined in
libcmtd.lib(typinfo.obj) MSVCRTD.lib
Error 6 error LNK2005: __vswprintf already defined in
libcmtd.lib(vswprint.obj) MSVCRTD.lib
Error 7 error LNK2005: _sprintf already defined in
libcmtd.lib(sprintf.obj) MSVCRTD.lib
Error 8 error LNK2005: _wcschr already defined in
libcmtd.lib(wcschr.obj) MSVCRTD.lib
Error 10 fatal error LNK1169: one or more multiply defined
symbols
found
d:\wf\integration\test4\InitialIntegration-Lib\InitialIntegration\CAAgent\D=
=ADebug\DeviceAccessMonitoring.dll
1
Error 12 error LNK2019: unresolved external symbol "public:
__thiscall
CDeviceAccessMonitor::CDeviceAccessMonitor(void)"
(??0CDeviceAccessMonitor@@QAE@XZ) referenced in function "int __cdecl
StartServiceThread(void)" (?StartServiceThread@@YAHXZ)
InitCAApp.obj
Error 13 fatal error LNK1120: 1 unresolved
externals
d:\wf\integration\test4\InitialIntegration-Lib\InitialIntegration\CAAgent\D=
=ADebug\InitCAApp.exe
1
I am creating several projects with static library. When i finally make
an executable using this static libraries. I am getting the above
errors.
What is the basic fundamental of using the static library in right way? Tag: SSH connections Tag: 265112
Runtime error 6034 again
Thanks to Alex and Viviana for their help!
Unluckily I am still struggling with the runtime error 6034. The annoying
thing is the error message keeps saying that "...You need to modify your
applications to build with a manifest."
Does this mean that I miss some steps when I build my binaries?
Yes, I did have all the manifests for each module of my binaries embeded.
Thus I remove all these from the folder of the exe/app.
"- I deploy the whole content of the directory Microsoft Visual Studio
8\VC\redist\x86\Microsoft.VC80.CRT (meaning the dlls and the
corrsponding manifest) into the application directory, at the same level
with my exes."
I tried this both ways,
1. Copied all files inside the folder, ...\VC\redist\x86\Microsoft.VC80.CRT,
into the folder of the exe (at the same level).
2. Copied the folder of "...\VC\redist\x86\Microsoft.VC80.CRT" into the
folder of the exe.
Both give me the same runtime error - 6034.
Another thing I did is since I compiled all modules in Debug mode, thus, I
copied the folder of "...\VC\redist\x86\Microsoft.VC80.DebugCRT", plus
"...\VC\redist\x86\Microsoft.VC80.DebugMFC."
By the way, can we avoid using such deployment scheme with 2005, or is there
a way we just do it like in 2003?
Thanks again,
DH Tag: SSH connections Tag: 265111
date and time
What is the simplest and most user-friendly way to enable someone to
specify a date and time in VC++?
Thank you. Tag: SSH connections Tag: 265108
VS 2005 and Manifest for runtime dlls
Hi all,
I'm having some problems with Visual Studio 2005 and even though I read
everything I could find in MSDNL I still couldn't find the answer.
Mainly my problem is that even though the manifest needed for the MS
runtime library is embedded into the binary the C:\Program
Files\Microsoft Visual Studio
8\VC\redist\x86\Microsoft.VC80.CRT\Microsoft.VC80.CRT.manifest is still
needed.
Detailed: I did the following steps:
1) New Project -> Win32 Console Application -> Empty project
2) Add new .cpp file with some code (as easy as possible), eg:
#include <stdio.h>
void main() { printf("MOMO"); }
3) Build the project in Release
4) Open the built .exe in the Visual Studio IDE (File -> Open -> File)
=> we can see the RT_MANIFEST being indeed 1, as suggested by MSDNL,
which means the manifest is embedded into the binary.
5) Copy this new binary, eg coco.exe on a Windows XP system with no
Visual Studio installed
Now there are the following scenarios:
a) Run coco.exe on that machine => error "The system cannot execute the
specified program.", when run from cmd prompt, or "This application has
failed to start because the application configuration is incorrect.
Reinstalling the application may fix this problem.", when double-clicked
in explorer. Not working might be normal as there are no runtime DLLs
b) copy the C:\Program Files\Microsoft Visual Studio
8\VC\redist\x86\Microsoft.VC80.CRT DLLs (msvcp80.dll and msvcr80.dll) on
the target machine in the same directory like the coco.exe and try again
to run coco.exe => the errors like above.
This is what I don't understand. Why isn't this enough taking in account
that the manifest is embedded in the binary?
c) If I also copy in the exact same directory where the DLLs and
coco.exe are the file Microsoft.VC80.CRT.manifest from C:\Program
Files\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT,
running coco.exe will work. But doesn't that mean that I have an
external manifest? If yes, means this is not what I want, as in MSDNL is
stated that having an external manifest is not a good idea as this won't
work if you load a DLL via LoadLibrary, so I want the manifest embedded.
In other words, can somebody pls:
I) explain why the scenario b) is not working
II) the C:\Program Files\Microsoft Visual Studio
8\VC\redist\x86\Microsoft.VC80.CRT\Microsoft.VC80.CRT.manifest is always
needed? Does this mean external manifest or not?
III) what do I need to do in order to deliver on the target machine the
DLLs in the same directory where the app is? (not WinSxS, and not a
subdirectory of the application directory)
Thanks in advance,
Viv Tag: SSH connections Tag: 265091
Why can't shift variable ?
Hi All,
I can't pass this complier:
void Boki (unsigned char ABC, unsigned int Data)
{
Boki_SendData(ABC);
Boki_SendData(Data >> 8); //send high byte
Boki_SendData(Data); //send low byte
}
err msg:
warning C4761: integral size mismatch in argument; conversion supplied
Don't know why error here....
Could you please advice how to fix that ?
Thank you very much!
Best regards,
Boki. Tag: SSH connections Tag: 265087
Functor adaptor question
I had a case today where I needed a functor that was a bound member
function. Basically:
class MyClass {
...bug free code omitted...
void PrintMe( int x ) {
printf( "%d\n", x );
}
void A_Function() {
...
std::vector<int> myList;
...
std::for_each(
myList.begin(),
myList.end(),
bound_mem_fun( *this, PrintMe ); // bound_mem_fun is made up
);
}
Am I correct in my conclusion that there is no such adapter in the standard
library? It looks like there is one in Boost, and it only took about 8
lines of code to implement it, but I don't want to reimplement it if there
is one built in that I missed.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc. Tag: SSH connections Tag: 265077
printing all kind of files
hi,
I am new to VC++. Are there any functions which can be used to print
all kind of files to the printer. I have tried, ShellExecute().. But it
is able to print only document files. I am not able to print image
files, ppts and some more.
I tried with OpenPrinter(), but i dont know how to send all kind of
files once we open it.
Then I also tried CDC.. With that also between StartDoc() and EndDoc()
what should be written for printing?
Please give some suggestions... Tag: SSH connections Tag: 265076
Runtime error 6034
I recently convert a solution of several projects from Visual Studio 2003 to
2005.
When distributing the binaries I encounter the problem which the exe cannot
start.
I did put all those DLLs and their manifest files, such as msvcr80.dll and
Microsoft.VC80.CRT.manifest, in the same folder (at the same level) of the
exe.
However when starting the exe, it gives me a runtime error:
R6034
An application has made an attempt to load the C runtime library incorrectly.
Could people here point out the cause of such a problem?
Note:
I did build all modules with "Embed manifest" setting to "Yes". And copied
all the manifest files for each modules into the same folder of the exe.
Thanks!
DH Tag: SSH connections Tag: 265066
IOCTL_DISK_CREATE_DISK
Hi,
I've been tasked with writing the front-end application to a storage array
product. One of the features is a setup wizard to initialize/partition/format
a new array. I've been looking into the problem and I'm having a hard time
figuring out how to get this done.
My expectation was that IOCTL_DISK_CREATE_DISK would initialize the disk for
me (I haven't got to partitioning or formatting yet). However, after the
DeviceIO call executes successfully nothing changes within the Disk
Management Snap-In. Shouldn't the disk entry now say "Initialized"? Either
the code or my expectations are incorrect =) Here's the code...
HANDLE hDevice;
BOOL bResult;
DWORD junk;
hDevice = CreateFile("\\\\.\\PhysicalDrive2",
FILE_ALL_ACCESS,
FILE_SHARE_READ |
FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
0,
NULL);
if (hDevice != INVALID_HANDLE_VALUE)
{
CREATE_DISK cd;
cd.PartitionStyle = PARTITION_STYLE_MBR;
cd.Mbr.Signature = 0x28;
bResult = DeviceIoControl(hDevice,
IOCTL_DISK_CREATE_DISK,
&cd, sizeof(cd),
NULL, 0,
&junk,
(LPOVERLAPPED) NULL);
CloseHandle(hDevice);
}
Perhaps the signature field has something to do with the problem. It wasn't
clear what I should set it to. I tried 0 and 0x28.
Thanks for your help... Tag: SSH connections Tag: 265061
Re: Socket Programming
My first reply never arrived in the newsgroup for some reason.
It has been > 12 hours since i sent it so i'll just resend.
>> I am trying to transfer a folder of files using socket. could anyone
>> help me by providing tips to send and receive. I want the files to be
>> saved with same file name as sent. anyone help me regarding this,
>
> For the data communication you can use this as a tutorial.
> http://www.codeproject.com/internet/server_client_sockets.asp
>
> The client has to tell the server to create a new folder. copying the
> files is simply done by sending a header that describes the name of the
> file and possible other attributes, and then send the file data.
> Implement different message types so that you can make a difference
> between commands and data.
>
> Or you could use FTP instead of creating your own mini file transfer
> protocol.
>
> --
>
> Kind regards,
> Bruno van Dooren
> bruno_nos_pam_van_dooren@hotmail.com
> Remove only "_nos_pam"
> Tag: SSH connections Tag: 265059
Easy way to read out formated string ?
Hi Experts:
I have a string which will always be in the format below:
"<string1><string2><string3>"
Any of string1, string2 and string3 could be null, and their lengths is not
known.
Just wondering, if there is an easy way to parse the whole string and read
out string1, string2 and string3 into 3 strings?
Thanks for any idea on this!
Polaris Tag: SSH connections Tag: 265057
Help is needed to compile C program using Visual Studie 2005
Hi,
I need your help.
I have a legend C program that works well after it was compiled under
Visial Studio 6.
Now a new version of Visial Studio 2005, V8 is installed on my machine.
And I failed to generate its *.exe file.
What I have done is:
1. Create a project under C++;
2. Select 32-bit window console project;
3. Add my *.c files into it.
4. Compile it.
Error information:
When I included statement:
#include "stdafx.h"
Error information:
Error 1 fatal error C1853: 'Debug\Filter.pch' precompiled
header file
is from a previous version of the compiler, or the precompiled header
is C++ and you are using it from C (or vice
versa) c:\0-filter\filter\filter.c 66
Line 66 points --> #include "stdafx.h"
When I excluded statement:
#include "stdafx.h"
Error information:
Error 1 fatal error C1010: unexpected end of file while looking
for
precompiled header. Did you forget to add '#include "stdafx.h"' to your
source? c:\0-filter\filter\filter.c 445
I don't know what to do to correct the situation.
Thank you.
Weng Tag: SSH connections Tag: 265048
Including only once - What is best practice?
What is the best practice to prevent duplication of includes?
From what I can see, you can use:
#pragma once
at the top of included headers, or:
#ifndef headerName
#define headerName
// header stuff here
#endif
If I create an include file that say needs <windows.h>, is it a best
practice to then include that in that header file to sort of document that
fact, and use one of the above techniques? If you see what I'm meaning.
Hope my noob question was clear enough.
Thanks Tag: SSH connections Tag: 265041
file folder transfer using sockets
hi,
I am trying to transfer a folder of files using socket. could anyone
help me by providing tips to send and receive. I want the files to be
saved with same file name as sent. anyone help me regarding this,
i am closing the old connection, WSAcleanup and creating new socket and
getting new connection for every file transfer.
at the other end also every time i am accepting the connection before i
receive the files.
Is the procedure i am following is correct & safe or not?
please answer this,
sirisha. Tag: SSH connections Tag: 265035
file folder transfer using sockets
hi,
I am trying to transfer a folder of files using socket. could anyone
help me by providing tips to send and receive. I want the files to be
saved with same file name as sent. anyone help me regarding this,
i am closing the old connection, WSAcleanup and creating new socket and
getting new connection for every file transfer.
at the other end also every time i am accepting the connection before i
receive the files.
Is the procedure i am following is correct & safe or not?
please answer this,
sirisha. Tag: SSH connections Tag: 265034
Hook an installable device driver
I use extensively win32 hooks in my application. I have a special library
for that and it works fine(its not a standard win32 event hooks, but win32
functions hook). Now I need to hook to an installable device
driver ( an acm codec)- to its function, "DriverProc". This is not a
standard win32 dll and thus the right way to hook it is to load
the driver, get a pointer to this function - DriverProc, and hook it.
I'm stack in this stage, how exactly to hook having this pointer in my
hands?
Does anyone have any idea how to do it?
Can someone here direct me please?
Thanks in advance. Tag: SSH connections Tag: 265033
Socket Programming
hi,
I am trying to transfer a folder of files using socket. could anyone
help me by providing tips to send and receive. I want the files to be
saved with same file name as sent. anyone help me regarding this,
sirisha. Tag: SSH connections Tag: 265028
How to suspend operation/threads in VC
Hi,
I tried
stdlib.h
sleep(10);
to no avail.
I need a resolution of millisec range
Thx
Jack Tag: SSH connections Tag: 265022
command line secure shell
I have a command line secure shell program and I would like to write my
own program to interact with it. I would like to perform both reading
and writing to the secure shell program. Could someone tell me the
best way to do this?
Thank you. Tag: SSH connections Tag: 265013
Embedding a resource at runtime
Hi there. Does anyone know if it's possible to embed a new resource into an
assembly at runtime as well as update an existing (assembly) resource. Any
assistance would be appreciated. Thanks. Tag: SSH connections Tag: 264983
Help Using WinDBG
Hi,
Can any one point me to the specific link of how to use windbg tool
properly for debugging complex applications.
Example How to track the Access Voilation error from withen the DLL
which may use other DLLs. Tracking the addresses of the function in the
memory. Tracking which function in which DLL is failing. Tag: SSH connections Tag: 264979
memory leakage in vc++ 6.0
am trying to develop an application to transfer a folder of files
using sockets. I have been using a loop to transfer all the files.
there are many memory leakage errors found in debugging. how can i
solve this?
the output is differing. and I am unable to find the exactly where
is the error in the code.
the code for sending is like this : in which i am sending the contents
in the order
file size, filename size, file name, file contents
void Sender::SendData(void)
{
CString findFilePath=filePathInformation+"\\*.*";
bWorking=finder.FindFile(_T((LPCTSTR)findFilePath));
while (bWorking)
{
bWorking = finder.FindNextFile();
CString findFileName(finder.GetFileName());
if(findFileName.Compare(".") == 0 ||
findFileName.Compare("..") == 0)
{
//CloseSocket();
continue;
}
int returnValue=SetAddress();
if(returnValue==0)
{
CString sendFilePath=finder.GetFilePath();
FILE *filePointer;
//int returnedValue;
if( (filePointer = fopen(sendFilePath, "rb" ))
== NULL )
{
cout<<endl<<"File open error";
CloseSocket();
return;
}
else
{
char *fileContentBuffer;
unsigned int bytesRead,fileNameLength;
long fileSize;
//long allocReqNum;
//first send the file size details
fseek(filePointer, 0, SEEK_END); //
Move File Pointer to EOF
fileSize=ftell(filePointer); // Get
position of File Pointer
rewind(filePointer); // Move File
Pointer back to beginning of
file
fileContentBuffer = (char
*)calloc(32,sizeof(long));
//returnedValue=_CrtIsMemoryBlock(fileContentBuffer, 32,
&allocReqNum, NULL, NULL);
ltoa( fileSize, fileContentBuffer,10 );
int returnValue =
send(mySocket,fileContentBuffer,32,0);
if(returnValue == SOCKET_ERROR)
{
cout<<endl<<"Error in Sending
File Length";
CloseSocket();
return;
}
else
cout<<endl<<"File Size Sent
Successfully : "<<fileSize;
//long
valueReturned=_CrtSetBreakAlloc(allocReqNum);
//delete fileContentBuffer;
free(fileContentBuffer);
//send file name length
fileNameLength=findFileName.GetLength();
fileContentBuffer = (char
*)calloc(32,sizeof(int));
char *returnChar=itoa( fileNameLength,
fileContentBuffer, 10 );
returnValue =
send(mySocket,fileContentBuffer,32,0);
if(returnValue == SOCKET_ERROR)
{
cout<<endl<<"Error in Sending
File Details";
CloseSocket();
return;
}
else
cout<<endl<<"File Length Sent
Successfully : "<<fileNameLength;
free(fileContentBuffer);
//delete fileContentBuffer;
//Send the file name
char *temporaryBuffer;
fileContentBuffer = (char
*)calloc(255,sizeof(char));
temporaryBuffer=findFileName.GetBuffer(fileNameLength);
strcpy(fileContentBuffer,temporaryBuffer);
returnValue =
send(mySocket,fileContentBuffer,fileNameLength,0);
if(returnValue == SOCKET_ERROR)
{
cout<<endl<<"Error in Sending
in File Name";
CloseSocket();
return;
}
else
cout<<endl<<"File Name Sent
Successfully : "<<temporaryBuffer;
free(fileContentBuffer);
//delete fileContentBuffer;
//sending the file
fileContentBuffer = (char
*)calloc(fileSize,sizeof(char));
bytesRead=fread(fileContentBuffer,sizeof(char),fileSize,filePointer);
returnValue =
send(mySocket,fileContentBuffer,fileSize,0);
if(returnValue == SOCKET_ERROR)
{
cout<<endl<<"Error in Sending
File Contents";
CloseSocket();
return;
}
else
cout<<endl<<"File Sent
Successfully "<< returnValue<<" bytes";
//delete fileContentBuffer;
free(fileContentBuffer);
}
//returnedValue=_CrtDumpMemoryLeaks();
fclose(filePointer);
CloseSocket();
}
else
{
cout<<endl<<"Error in connecting";
CloseSocket();
return;
}
}
}
could u please help regarding this.
that would be greatful to me,
sirisha. Tag: SSH connections Tag: 264965
Get current windows profile name
Hello,
What is the Win32 API to obtain current logged in user name or a special
unique ID without having to login as adminstrator
thank you Tag: SSH connections Tag: 264961
[OT] Google Hates MSDN?
Hi All,
I understand this is OT, but has anyone else noticed that Google seems to
hate the MSDN now? where previously something like sprintf etc would have
referenced the MSDN in the top page or so, now the MSDN docs are usually
no-where to be found on a google search.???
--
- Mark Randall
http://www.temporal-solutions.co.uk
"We're Systems and Networks..."
"It's our job to know..." Tag: SSH connections Tag: 264960
C++ equivlence of int[][] x.length
Hi,
In java, you can extract the height and width of an array. In C++, how can u
do the same?
In java, I do this
int width = img[0].length;
int height = img.length;
Type of img is int[][]
Thanks in advance
Jack Tag: SSH connections Tag: 264955
Format time Year Month Day hour minute second millisecond
How can one format the time in order of increasing precision:
Year Month Day hour:min:sec.millisec
ie. 2006 6 5 11:40:35.456
Right now I have this setup that results in: Fri May 26 13:03:30.451
struct _timeb g_tstruct;
_ftime( &g_tstruct );
fprintf(LogFile, "%.19s.%hu\n", ctime( & ( g_tstruct.time ) ),
g_tstruct.millitm );
and have seen that another %s could be used to hold the year found from
&g_tstruct[20].
But I haven't been able to find any other formats available.
Thanks, Tag: SSH connections Tag: 264952
slider control problem, first control in slider control array could not be set
Dear people out there,
I cant see through the tomatoes on my eyes, so I ask you to help me
overcome my human weakness.
I got the following problem:
I've got 10 sliderbars in defined an array and assigned the controls to
the corresponding ID's.
Here some code, if not enough, I give u more
// the slider bars
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_1, m_sliderBars[0]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_2, m_sliderBars[1]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_3, m_sliderBars[2]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_4, m_sliderBars[3]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_5, m_sliderBars[4]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_6, m_sliderBars[5]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_7, m_sliderBars[6]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_8, m_sliderBars[7]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_9, m_sliderBars[8]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_10, m_sliderBars[9]);
for (i=0; i<10; i++ ) {
m_sliderBars[i].SetRange(0, 5000);
m_sliderBars[i].SetPos(200);
}
The problem is, the first sliderbar sets its range between 0 and 100
and the position to 0, no mather what I do.
This is not what I want it to do.
Is there anything I did not take into account, or do I really have a
problem and should look for a doctor checking my eyes.
I am desperate, since I dont see, why it wont work.
Would anybody show a little mercy and spend a few minutes for me
please?
Thank you in advance. Tag: SSH connections Tag: 264946
slider control problem, first control in slider control array could not be set
Dear people out there,
I cant see through the tomatoes on my eyes, so I ask you to help me
overcome my fucked up human weakness.
I got the following problem:
I've got 10 sliderbars in an array and assigned the controls to the
corresponding ID's.
Here some code, if not enough, I'll give you more.
// the slider bars
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_1, m_sliderBars[0]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_2, m_sliderBars[1]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_3, m_sliderBars[2]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_4, m_sliderBars[3]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_5, m_sliderBars[4]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_6, m_sliderBars[5]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_7, m_sliderBars[6]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_8, m_sliderBars[7]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_9, m_sliderBars[8]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_10, m_sliderBars[9]);
for (i=0; i<10; i++ ) {
m_sliderBars[i].SetRange(0, 5000);
m_sliderBars[i].SetPos(200);
}
The problem is, the first sliderbar sets its range between 0 and 100
and the position to 0, no mather what I do, this is not what I want it
to do.
Is there anything I did not take into account, or do I really have a
problem and should look for a doctor checking my eyes.
I am desperate, since I dont see, why it wont work.
Would anybody show a little mercy and spend a few minutes for me
please?
Thank you in advance. Tag: SSH connections Tag: 264945
Why fscanf_s does not work ??
Try to debug this code, fscanf_s does not read from an input text file
numbers.txt that has 20 integers separated by a space. What I am doing
wrong ??
#include <stdio.h>
#include "stdafx.h"
#include <stdlib.h>
#define SIZE 20 /* size of elements in the the sequence of numbers */
int _tmain(int argc, _TCHAR* argv[])
{
int array[SIZE];
int i, pass, hold;
FILE *fp;
/* opens the file in in read only mode */
if(fopen_s(&fp,"d:\\numbers.txt","r")!=0)
{
printf("Error opening the file\n");
exit(1);
}
/* load the data in the array */
else
{
for(i=0;i<=SIZE-1;i++)
{
fscanf_s(fp,"%d",&array[i]);
}
}
fclose(fp);
/* show data */
for(i=0;i<=SIZE-1;i++)
{
printf("%d ", array[i]);
}
printf("\n");
return 0;
} Tag: SSH connections Tag: 264939
manifests and Vista Beta2
Not sure where the best place for this is as I can't find a
'Vista/programmer' type of newsgroup. I've got a VC 8 MFC application that
I've written that installs fine on XP and on Vista Beta2 and runs fine on XP.
But when I try to run it on a Vista Beta2 system, it complains that the
'side-by-side configuration is incorrect' and tells me to check the event
log. I can't tell much from the event log but it tells me to run the
'sxstrace'. When I try to do that it tells me 'access denied'. Any ideas if
this is just a Vista problem or if there's something I need to do with my
build/setup so that it'll run on Vista? Thanks! Tag: SSH connections Tag: 264938
Cannot convert from 'Type' to 'const Type&' error with templates
Hello,
I encountered strange compilation error, so I want to hear
what other people say before I blame the compiler.
My environment: VC++2005, XP/Win2K.
I made helper function, which helps to build predicates for
many standard algorithms. The point of the function is that
it compares certain member of the class instead of whole
class object. Here's the code:
---------
////////////////////////////////////////////
// Template class for composition f(g(x))
template<typename F, typename G>
class compose_t :
public std::unary_function<
typename G::argument_type,
typename F::result_type
>
{
public:
explicit compose_t(const F& f, const G& g)
: m_f(f), m_g(g) {}
typename F::result_type operator()(
const typename G::argument_type& x) const
{
return m_f(m_g(x));
}
private:
F m_f;
G m_g;
};
// Template function to construct compose_t
template<typename F, typename G>
compose_t<F, G> compose(const F& f, const G& g)
{
return compose_t<F, G>(f, g);
}
////////////////////////////////////////////
// Sample class
struct X
{
X(const char* s, int n) : s_(s), n_(n) {}
const std::string& GetS() const { return s_; }
std::string s_;
int n_;
};
////////////////////////////////////////////
// Helper function to form arbitrary predicate
template <
typename T,
typename Func,
typename Pred
>
compose_t<std::binder2nd<Pred>, Func>
mem_match(
const T& val,
Func fn,
Pred pr = std::equal_to<T>()
)
{
return compose(std::bind2nd(pr, val), fn);
}
////////////////////////////////////////////
//
int _tmain(int /*argc*/, _TCHAR* /*argv*/[])
{
typedef std::vector<X> XVec;
XVec v;
v.push_back(X("one", 1));
v.push_back(X("two", 2));
v.push_back(X("three", 3));
XVec::iterator it = std::find_if(
v.begin(), v.end(),
mem_match(
std::string("two"),
std::mem_fun_ref(&X::GetS)
)
);
return 0;
}
---------
The problem is that mem_match doesn't compile. Compiler
issues error C2783: could not deduce template argument for
'Pred'.
So, now I tried this one:
template <
typename T,
typename Func
>
compose_t<std::binder2nd<std::equal_to<T> >, Func>
mem_match(const T& val, Func fn)
{
return compose(
std::bind2nd(
std::equal_to<T>(), val), fn);
}
This compiles without any problem, however I cannot control
std::equal_to predicate from the outside of mem_match.
I cannot specify std::binary_function as template parameter
for std::binder2nd, since std::binary_function doesn't have
operator() at all, and compiler rightfully complains about
it.
How can I control predicate for mem_match?
Thanks in advance
Alex Tag: SSH connections Tag: 264936
OOP problem!
Hello,
Just to not cause any contreversy:
"I understand that class definitions go in headers and method
implementations go in CPP files, however to simplify things, I put everything
under one listing!"
okay!
"A_CTR" class derives from "actions" class and "actions" class derives from
"components" class.
ALSO:
"T_CTR" class derives from "transitions" class and "transitions class
derives from "components" class.
So, its doing like a pyramid, with "components" class at the top, and where
"actions" and "transitions" classes are right below "coponents". Further,
"A_CTR" class is underneath "actions" and "T_CTR" is under "transitions".
I guess this can be better viwed in the code below.
Please consider the following code and see question after code:
===============================================
class components
{
public:
components(){}
components(int Flag);
virtual ~components() {}
static int FLAG_AllTrueInCase;
protected:
};
//ADT
class actions:public components
{
public:
actions(){}
virtual ~actions(){}
virtual bool conv_BOOL_INPUT_INTERNAL(
int Bool_ID_INPUT1,int Bool_ID_INTERNAL1, IO *io);
protected:
};
class A_CTR:public actions
{
public:
A_CTR(){}
virtual ~A_CTR(){}
virtual int SYS_getCnstCount(int i_COunterID)const;
virtual void setCounter(int i_CounterID,int i_CountCnst);
protected:
int iCount1Cnst;
int iCount2Cnst;
int iCount3Cnst;
};
int A_CTR::SYS_getCnstCount(int iCounterID)const
{
...other code...
return iCount1Cnst;
}
void A_CTR::setCounter(int iCounterID, int iCountCnst)
{
...other code...
iCount1Cnst = iCountCnst;
}
//ADT
class transitions:public components
{
public:
transitions(){}
virtual ~transitions(){}
};
class T_CTR:public transitions
{
public:
T_CTR(){}
virtual ~T_CTR(){}
virtual bool get_CTR_Ellapsed(int i_CounterID, int i_BranchDest);
protected:
int iC1CurrentCount;
int iC2CurrentCount;
int iC3CurrentCount;
};
bool T_CTR::get_CTR_Ellapsed(int iCounterID,int iBranchDest)
{
int xxx;
xxx = A_CTR::SYS_getCnstCount(1); /// *** ERROR! *** on this line!
}
===================================================
What if we are in a method of the T_CTR class and we wish to access a member
of the A_CTR class?
The following line:
xxx = A_CTR::SYS_getCnstCount(1); /// *** ERROR! *** on this line!
causes the following error:
c:\_DTS_PROGRAMMING\C_PROGRAMMING\vc++\MY_APPS_LAB\XPPLC\WndProc_ClassMethods.h(375):
error C2352: 'A_CTR::SYS_getCnstCount' : illegal call of non-static member
function
I somehow have the feeling I have coded something wrong *again*..... I am
looking hard to find the problem, but obviously not hard enough, and
furthermore, a book example does the same thing... I don't know what to make
of it?
Just when I thought that I was getting this classes stuff, I get this! :-)
Can someone please tell me what am I doing wrong?
*ALL* support appreciated!
--
Best regards
Robert Tag: SSH connections Tag: 264935
understanding Windows printing
Windows or MFC, I'm not sure which.. whatever the code below represents.
I want to print text to a label printer. I'd like to center the text in
the label and increase the font size over whatever the default is. I
don't understand the RECT thing or how to calculate coordinates or use
fonts. The code below works and it's pretty simple, I'd like to stay
with this scheme if possible (I have similar code elsewhere in the app).
I copied it from MSDN, I think.
Can someone explain how to use a standard Windows font like Arial 12 and
center the text, or point me to a tutorial?
Thanks
---------------
CDC cdc;
HDC hdc;
CPrintDialog dlg(TRUE); // Windows Printer Dialog class
CString formattedpage;
if (dlg.DoModal() == IDOK)
{
// Create a printer device context (DC)
// based on the information
// selected from the Print dialog.
hdc = dlg.CreatePrinterDC();
ASSERT(hdc);
// Attach Device Context object to handle
cdc.Attach(hdc);
cdc.StartDoc("Pan Label"); // begin a new print job
}
else
{
// abort print
}
RECT rect = {0,0,0,0}; // RECT structure for page
cdc.DrawText(formattedpage,&rect,DT_CALCRECT);
cdc.StartPage();
formattedpage.Format("STUFF TO PRINT");
cdc.DrawText(formattedpage,&rect,DT_NOCLIP);
cdc.EndPage();
cdc.EndDoc(); Tag: SSH connections Tag: 264934
IViewObject::Freeze
hi
Im confused with calling IViewObject::Freeze.
What am i suposed to pass for the second parameter ?
DWORD key=0;
HRESULT hr = m_pView->Freeze(DVASPECT_CONTENT, 0, NULL, &key);
Freeze returns -2147467263
thanks Tag: SSH connections Tag: 264932
Form resource files
Hi there. I apolgize for posting this again (from June 2nd) but I've been
researching for many days now with no success. I have an app that will be
reading arbitrary ".resx" or "resources" files passed on the command line
for instance. Given only a resource file IOW, does anyone know:
1) How the app can determine if the passed resource file contains
(localized) form resources (i.e., it stores a form)
2) If it does contain (localized) form resources, how can I then generate
that form dynamically
Note that the native .NET utility "Winres.exe" is able to do this but I
can't figure out how (not without using techniques that appear to be
undocumented). Any help would be greatly appreciated. Thanks. Tag: SSH connections Tag: 264931
Visual C/C++ 6.0. Using SEH
I'm facaing a problem in using SEH (structured exceptions handling) in VC 6.0.
Please, create (using Visual C/C++ 6.0) an Empty Console application. Use
following source to build the application:
--------------------------------
class A
{
public:
operator const __int64() const
{
return 33i64; // random number
}
};
inline bool operator!=(const A& val1, const __int64 val2)
{
return false; // doesnt matter what it returns
}
static A g_a;
bool func()
{
__try
{
return (g_a != 0i64);
}
__finally
{
}
return 0;
}
void main(void)
{
// Check the returned value
bool bRetVal = func();
} // Place a breakpoint here and check the value of bRetVal.
--------------------------------
Run the application and check the value returned by func(). In my case it is
24, but it should be false <zero>. Actually (after number of tests) I found
that it is a random number.
Can somebody, please, explain what is goig on?
This code should be working, or I should get a compiler error.
I'm not looking for workaraoung. I just want to understand - am I wrong, or
there is something with the compiler. Thank you !!!
* I've tried the same source using VC 2003 and it works fine. Tag: SSH connections Tag: 264919
Get filename and path of a file selected on the desktop
Hi,
Is there a way to obtain a filename and path (or just a handle of a
file, but without knowing its name nor path) of a file(s) selected on
the desktop (with LEFT click). As far as I know there's no such api
function. "Shell extensions on right click" are NOT what I'm looking
for... When I click a file in any window, Explorer runs a few functions
like ReadFile, CreateFile and in some magical way gets it's name and
path. I searched the web but with no luck. I could make a filesystem
hook and intercept calls on functions like ReadFile or CreateFile, but
I would need only those calls, that are made when I select one or more
files in a Explorer window. And that is what I am not able to do,
because of my lack of knowlegde on that topic. If you can, please help Tag: SSH connections Tag: 264917
how to turn jpgs to vector
Hi,
Are there any handy ways like GDI+ to convert between jpgs and vector
formats?
Linux platform equvilence is appreciated too
Thanks
Jack Tag: SSH connections Tag: 264902
how to record and save extracted audio in vc++
hi all,
I have a video format(.cam) and audio files are stored in it.I can able
to extract and play audio using waveout funtions in wave class.
I would like to save the extracted audio in .wav format.
how to do this.do i need to add any class like waveIn
I saw the following code to record wav file.
// Uses the MCI_OPEN, MCI_RECORD, and MCI_SAVE commands to record and
// save a waveform-audio file. Returns 0L if successful; otherwise,
// it returns an MCI error code.
DWORD recordWAVEFile(DWORD dwMilliSeconds)
{
UINT wDeviceID;
DWORD dwReturn;
MCI_OPEN_PARMS mciOpenParms;
MCI_RECORD_PARMS mciRecordParms;
MCI_SAVE_PARMS mciSaveParms;
MCI_PLAY_PARMS mciPlayParms;
// Open a waveform-audio device with a new file for recording.
mciOpenParms.lpstrDeviceType = "waveaudio";
mciOpenParms.lpstrElementName = "";
if (dwReturn = mciSendCommand(0, MCI_OPEN,
MCI_OPEN_ELEMENT | MCI_OPEN_TYPE,
(DWORD)(LPVOID) &mciOpenParms))
{
// Failed to open device; don't close it, just return error.
return (dwReturn);
}
// The device opened successfully; get the device ID.
wDeviceID = mciOpenParms.wDeviceID;
// Begin recording and record for the specified number of
// milliseconds. Wait for recording to complete before continuing.
// Assume the default time format for the waveform-audio device
// (milliseconds).
mciRecordParms.dwTo = dwMilliSeconds;
if (dwReturn = mciSendCommand(wDeviceID, MCI_RECORD,
MCI_TO | MCI_WAIT, (DWORD)(LPVOID) &mciRecordParms))
{
mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
return (dwReturn);
}
// Play the recording and query user to save the file.
mciPlayParms.dwFrom = 0L;
if (dwReturn = mciSendCommand(wDeviceID, MCI_PLAY,
MCI_FROM | MCI_WAIT, (DWORD)(LPVOID) &mciPlayParms))
{
mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
return (dwReturn);
}
if (MessageBox(hMainWnd, "Do you want to save this recording?",
"", MB_YESNO) == IDNO)
{
mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
return (0L);
}
// Save the recording to a file named TEMPFILE.WAV. Wait for
// the operation to complete before continuing.
mciSaveParms.lpfilename = "tempfile.wav";
if (dwReturn = mciSendCommand(wDeviceID, MCI_SAVE,
MCI_SAVE_FILE | MCI_WAIT, (DWORD)(LPVOID) &mciSaveParms))
{
mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
return (dwReturn);
}
return (0L);
}
if I add this code in wav.cpp,i got errors
Please give me suggestions and ideas..
help me
Regards,
Sangeet Tag: SSH connections Tag: 264899
MScomm control faster or ReadFile faster?
Hi All,
It seems that we can use MScomm control or ReadFile (com_handle,
fifo_buffer, 254, &read, 0) to read com port data.
Which one is faster ?
P.S could you please advice how to add mscomm control to project?
Best regards,
Boki. Tag: SSH connections Tag: 264895
How to know how many bytes in buffer?
Hi All,
In VB, we can use "MSComm1.InBufferCount" to get the count of uart
buffer.
Could you please advice how to do that in VC?
Thank you very much!
Best regards,
Boki. Tag: SSH connections Tag: 264890
How to use WIN32 API in VC?
Hi All,
I have a WIN32 API call from VB:
Public Declare Function GetTickCount Lib "kernel32" () As Long
Could you please advice how to use it in VC?
Thank you very much!
Best regards,
Boki. Tag: SSH connections Tag: 264889
OT: stroke "orientation"
Sorry. I don't know any relevant newsgroups.
What I want to do is to able to recognize a rear license plate of a car. Say
due to the shot angles, the images are more or less skewed. At first
attempt, I was trying to transform the images using affine transformation to
make it erect 90 degrees as normal characters and compared with some
predefined character shapes. The new characters recognized would be put into
a nero-network. Now I have changed my mind, I would like to know how the
letters strokes are orientated. Say an O is always round and hollow, so each
time I see somethin' like this, I would say eh... this is an O. Are there
any ways I can do this? or any references that I can look?
Thanks
Jack Tag: SSH connections Tag: 264887
Is there any kind of support for SSH connections in VC++?
<mike7411@gmail.com> wrote in message
news:1149805173.463285.241860@g10g2000cwb.googlegroups.com...
> Is there any kind of support for SSH connections in VC++?
Your best bet is probably to use WinHttp or WinINet.