AfxBeginThread
Is there any automatic way to have AfxBeginThread or some other thread
creation function call a class's member function directly?
I don't see how the "this" pointer would get there. Tag: automatically rename Tag: 266747
A matter of style?
Hi All,
I have seen if tests written both of the ways shown below. Is
this just considered a matter of personal style or do you feel
there's some inherent advantage of doing it one way or the other?
I typically do it the second way.
if ( 0 == MyFunc( stuff) )
{
}
if ( MyFunc( stuff ) == 0 )
{
}
- Arnie Tag: automatically rename Tag: 266742
WinForms and header filers
Hi,
I recently posted this question in another group, but this group I
believe is a better choice for this topic:
I am working on my very first project in Visual C++ 2005 and had
just created my very first form (Windows Form) , added a button, a meny
and other stuff a regular project contains.
But then it struck me that when adding events and such (in this case
events) it created a definition for the method (event handler) in the
header file that was created when I created the form. So the event code
was both the declaration and the definition!
As a C++ programmer, that turned my stomach inside out!
What I do want is the declaration in the headerfile and the definition
(the logic) in a separate source file.
The project is very large (! , and a rewrite from another development
platform) and a good structure is critical for the success of the
project.
So, how to *automaticlly*, when adding a new event, put the declaration
in the header file (that is connected to the form) and the definition
in a separate source file (.cpp)
Any answer or link to a resource is welcome!
(hope you understand what I am after) Tag: automatically rename Tag: 266727
serialiazation, carchive issue with vc8 and vc6
Hi all
I've recently exported one of our tools to VC8, after some minor
changes it compiles and appears to work ok, it can open and close files
which it has created etc. The vc8 migrated app exports a file using
carchive which again appears to be workign fine except when it is to be
read using an application compiled using vc6.
Are there any known problems when reading vc8 serialized files with a
vc6 product.
Note that migrating the vc6 project to vc8 is currently not an option Tag: automatically rename Tag: 266726
V2005 Syntax Highlighting (new words?)
Hi,
Does anyone know if it is possible to (and if so how) to add new words to
the syntax highlighting list on Visual Studio 2005.
Although not a keyword, I wish to make the symbol 'Ascii' highlighted to
make it stand out from the rest of the code and improve readability.
--
- Mark Randall
http://www.temporal-solutions.co.uk
http://www.awportals.com Tag: automatically rename Tag: 266719
When to free BSTR after casting to CString (client or COM server)
Hey All,
I am wondering when I should free a BSTR that is past to a COM
component and cast to a CString for internal use. Specifically, say
I've declared a function like this in my COM component:
HRESULT Test([in] BSTR arg);
The client has to give my Test function a valid BSTR object. Perhaps
that looks something like this:
BSTR s;
s = SysAllocString(L"Hello");
Test(s);
SysFreeString(s); // Should I free this here...
Then, say my Test function is implemented like this:
HRESULT Test(BSTR arg)
{
CString s(arg, SysStringLen(arg));
SysFreeString(arg); // or should it be freed here?
// Do stuff w/ the CString s.
return S_OK;
}
As you can see, I'm a little confused as to where the BSTR should be
freed, in the client or server. I am guessing it should be freed in the
client, but I wanted to get a second opinion on that.
TIA!
--
Regards,
Travis Spencer Tag: automatically rename Tag: 266718
Linking error Error return code-'0x458'
I tried to compile VC4.0 application in VC++8.0 version. here some of the
linked to create DLL files. Those libraries were compiled in 32 bit
architecture.
The *.obj of the *.cpp files are generated properly, While linking those obj
with existing lib(32bit architecture) I am getting the folllowing error.
---------------------------------------------------------------------
Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
link.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\1\nm138.tmp
CommonDLL.obj : fatal error LNK1112: module machine type 'x64' conflicts
with target machine type 'X86'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio
8\VC\bin\amd64\link.exe"' : return code '0x458'
Stop.
--------------------------------------------------------------------------------------------
my question is..
Whether can we link 32-bit library in 64-bit production environment? does it
work?
I am waiting for any one reply. Tag: automatically rename Tag: 266714
Speed problem
Hi,
I have a small problem here. I put in a paper today, which was basically a
programming project for a
sudoku solver.
I got the programm working without a problem, but somehow the algorithm
isn't running as fast as I thought it would.
I talked to some of my colleagues and they basically told me that their
algorithms were mostly not more complex than
mine. Mostly even more simply, yet their programs solved a certain set of
100 sudokus in under 2 minutes, where
mine needed 15 minutes.
I activated all optimization options, used /O2 in Visual C++ but that only
gave me like 2 seconds less computing time.
I went throught the algorithm over and over and I am sure that it does work
correctly, I put it on 20000 different sudokus
in a file I found and it solved them all in a time of about 1.6 seconds per
sudoku, which is simply not fast enough.
Problem is I don't have any idea why it is so slow, while other programs
which do basically do exactly the same are
doing it so much faster.
Don't missunderstand me, I don't want to get you to help me get more points,
I put the project in already anyway.
It's just that I will only get a score for the project, but no explanation
on why it was so slow and since I am simply
curious on what I did wrong I would appreciate if anyone her could give me a
hint or two.
I will upload the code under the following link so I don't have to put it in
here, since even just writing the functions which
actually do compute the algorithm would still be too much for a post here.
I don't want to short it down though, since I want to show you the actual
code as is so you can find anything
that might be slowing it down too much.
I know looking through all that code is a little work, but I would really
appreciate any help.
Again, my problem is not correctness or how to do it, but how to do it
faster, a lot faster.
Thanks in advance... here's the link:
http://www.wcrevival.de/joker/CSudokuRiddle_cpp.txt Tag: automatically rename Tag: 266713
warning C4013: 'GetComputerNameEx' undefined
Hello,
I have a simple C program that invokes GetComputerNameEx() with
'(COMPUTER_NAME_FORMAT)ComputerNameDnsFullyQualified' value as first
parameter. During compilation (via cl.exe command line or as part of
VC 2003 project), I consistently get compile error (see "subject line"
above). That is happening despite the following definitions on my
WinXP system:
#ifdef WINVER
#undef WINVER
#endif
#define APPVER 5.0
#define WINVER 0x0501
#define _WIN32_WINNT WINVER
#ifndef NTDDI_VERSION
#define NTDDI_VERSION NTDDI_WINXPSP2
#endif
How can I compile a program that tries to use GetComputerNameEx()?!? Tag: automatically rename Tag: 266708
tcp socket
hi,
Can tcp socket be a one way communication. If i am only reading from
server(receive( , , , )), do i still have to write to server (send ( , , , ))
after each recieve call !!!!
-thiru Tag: automatically rename Tag: 266702
ToTitleCase
I am converting some code to work in windows and I came across a function
called ToTitleCase(). Is there a win32 equivalent to this? I found a
ToUpper & ToLower but no ToTitle.
Thanks
Bob Tag: automatically rename Tag: 266699
CXX0030: Error: expression cannot be evaluated when connecting to SQL server
Hi all,
I try to connect to a SQL database and get a 'CXX0030: Error:
expression cannot be evaluated' due to the connection->Open function.
The connection string was verified and therefore should work. I have no
real idea where the problem is situated...
I hope someone can help me out. Thanks in advance.
Stijn
try
{
m_hr = connection.CreateInstance(__uuidof(ADODB::Connection));
connection->CursorLocation = ADODB::adUseClient;
connection->Open(L"Provider=SQLOLEDB.1;Integrated
Security=SSPI;Initial Catalog=testing;Data Source=.",L"", L"",
ADODB::adConnectUnspecified);
}
catch (_com_error &e)
{
e.Description();
} Tag: automatically rename Tag: 266698
pixel decimation
Hi all,
How to do decimation. For example, I have a line of image pixel 2500. My
screen resolution is 1280 by 1024. If i want the image to be displayed
without a scroll bar in the bottom, How should i print the pixels on screen.
any help would be great.
Thanks,
-thiru Tag: automatically rename Tag: 266694
Creating a unique path separator
Hi,
If i have a tree structure, where the names can have ANY character in
them, what would be the best method for finding a 'unique series of
characters' to use as a separator when writing a path to an XML file?
For instance, the structure could look like this:
!"=A3$%^&*()_+1234567890-
QWERTYUIOP{}qwertyuiop[]
ASDFGHJKL:@~asdfghjkl;'#
|ZXCVBNM<>?\zxcvbnm,./`=AC
then im stuck for using a single character (lets pretend that all the
extended characters have been used aswell - it could happen ... and
probably will when i least want it to), so i have to use two characters
for the separator. But of course, all the two character combinations
could have been used up aswell in a gargantuan super path! So i would
need to use three (or more - getting more and more unlikely, i know).
All good suggestees will have a planet named after them,
James. Tag: automatically rename Tag: 266688
peculiar error, res.dll missing
I have migrated one project from VC++ 6.0 to .NET2003(managed C++). I
have modified the required code according to the .NET libraries. It is
executing fine in both Debug mode as well as release mode.The name of
the project is ardtd.
The problem is while running the application(not from IDE). I put the
exe and all the dlls required for that application. If i click on the
exe file, it is supposed to execute fine but
It says ardtdres.dll not found.
I'm getting this error on the systems where .NET is not installed even
though .NET framework is installed. If .NET is installed on the machine
I'm not getting this error.
Please let me know if you have any idea about this problem, Thank you
in advance Tag: automatically rename Tag: 266685
Newbie adding COM components to a project
Hi,
I am an experienced java and VB6 developer and had about 2 years
experience of C++ about 8 years ago (but on UNIX).
I have a COM object that I have used a lot in the VB6 environment by
simply adding it to the references. I am then able to refer to the
objects easily and intellisense works great.
I am trying to write some code in C++ but I am having problems adding
the COM object to the project. I do not know where to begin. I have
access to the dll and to the tlb. Is there an easy way to do this?
I am currently using Visual Studio 2005 Express but may be able to get
my hands on the full VS 2005 environment.
Any help really appreciated. Thanks
David Tag: automatically rename Tag: 266684
red exclamation mark icon
Hi,
Where I can find "red exclamation mark" icon, I was looking for this in
few dll's but failed?
m. Tag: automatically rename Tag: 266681
error LNK2022: metadata operation failed - using Templates?
I've seen several previous posts related to LNK2022 errors using
templates, but I have not seen a resolution (one other person said the
error goes away if he does not make his class a template, but that's
not a preferred solution for me, as it wasn't for him) .
I have a template LinkedList class that I can use successfully within
the .Net form.h file, but if I try to access it from within another
class (only in that class, no longer in the form) it compiles fine but
then I get two link errors:
City.obj : error LNK2022: metadata operation failed (80131187) :
Inconsistent method declarations in duplicated types (types: node;
methods: .ctor): (0x06000003).
City.obj : error LNK2022: metadata operation failed (801311D6) :
Differing number of methods in duplicated types (node): (0x02000004).
I've commented out most of the lines of code so I know that this error
occurs when I include a method call from with the City object to the
linked list method insertAtHead.
The linkedlist class (reduced for this example) is:
#pragma once
template <typename Item>
ref class LinkedList
{
private:
ref class node
{
public:
node() { data = Item(); link=nullptr; }
node(const Item% init_data, node ^init_link)
{ data = init_data; link = init_link; }
Item data;
node ^link;
};
public:
typedef node ^NodePtr;
LinkedList(void);
void insertAtHead(const value_type% entry);
private:
NodePtr head;
};
and in the cpp file:
template <typename Item>
LinkedList<Item>::LinkedList(void)
{
head = nullptr;
}
template <typename Item>
void LinkedList<Item>::insertAtHead(const Item% entry)
{
head = gcnew node(entry, head);
}
In the City class, I have:
#pragma once
#include "LinkedList.cpp"
ref class City {
public:
City(System::String^ cityName);
void addDest(City^ dest);
private:
System::String^ name;
LinkedList<City^> destList;
};
and in the City.cpp file:
void City::addDest(City^ dest) {
destList.insertAtHead(dest);
}
If I comment out destList.insertAtHead(dest); I no longer get the
linker errors.
As stated above, the LinkedList files (unmodified) work if I put the
declaration of the linked list and calls to insertAtHead in my Form1.h
file. Why should it make a difference if they are in my City class
instead?
Any suggestions would be greatly appreciated!
cyndi Tag: automatically rename Tag: 266678
dllregisterserver not registering com classes
I have a COM DLL (created with the ATL COM wizard). It comes with the
function:
// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void)
{
// registers object, typelib and all interfaces in typelib
HRESULT hr = _AtlModule.DllRegisterServer();
return hr;
}
This function does get called when the object is registered, but none
of the interfaces I have defined get registered.
Do I need to put code in to manually register my objects? What does
that function register, then?
Thanks,
-PaulH Tag: automatically rename Tag: 266671
Making Type Library for normal Windows DLL (not a COM server)
I read this artical and tried to create tlb for my C++ class.
import "oaidl.idl";
import "ocidl.idl";
[
uuid(634FE8B5-C847-4b25-B135-B39312741EDE)
]
library Vdll_1Lib
{
importlib("stdole2.tlb");
[
dllname("Vdll_1.dll")
]
module Vdll_1Mod
{
//[entry(1)] void Calculate_1(void);
[
entry("Calculate_1")
]
void Calculate_1 (void);
}
};
----------
LIBRARY "Vdll_1.dll"
EXPORTS
Calculate_1
------
#import "C:\Test\Vdll_1\Debug\Vdll_1.tlb"
I am getting linking problems .
ClientClass.obj : error LNK2019: unresolved external symbol "void
__stdcall Vdll_1Lib::Calculate_1(void)" (?Calculate_1@Vdll_1Lib@@YGXXZ)
referenced in function "public: virtual long __stdcall
CClientClass::Add(wchar_t *)" (?Add@CClientClass@@UAGJPA_W@Z)
Debug\ClientVdll.dll : fatal error LNK1120: 1 unresolved externals.
Any suggestions for this issue?
thanks
abhi Tag: automatically rename Tag: 266662
VC++ vs. FoxPro
I've generated a DLL with Visual FoxPro 9.0 and, on the other side, I've go a
VC++ project wich uses DLL methods. I Copy the TLB file into VC++ project
folder and the I rebuild EXE.
If I create the DLL in VFP 6.0 it works ok, but if I do in VFP 9.0, when I
build EXE, it says 'Function does not take <n> parameters'.
I call DLL functions in this way:
vResult = Iobj->mymethod(vparam, vparam, ...); Tag: automatically rename Tag: 266659
Urge for help in a game programming
Four Win
Description
To program the play named "four win", the background board should
consist of a lattice with 7 columns, into which in each case 6 stones
fit. The playing field stands perpendicularly, so that a stone falls
always widen-possible downward.
The rules are :
1=2E The goal of the Game is to place four stones in a row or column wise
or diagonally as a first player.
2=2E Each player receives 21 stones of his colour (pink/green).
3=2E The green player begins.
4=2E The player lets a stone fall alternating into a row.
5=2E If no more places are in a row, then this may not be selected.
6=2E Winner will be the player, who can accommodate first four stones in
a continuous manner (horizontally, vertically, diagonally).
7=2E If the backboard is full and there is no certain winner, then the
play ends undecided.
For a better understanding go to:
http://www.kielack.de/games/fourwins.htm
The program is to cover the following capability characteristics:
=B7 Play between two human players.
=B7 Play between a human and a computer player.
=B7 Play between two computer players.
=B7 Each player is to extend the abstract class ,,Player ", which is
available on the practical course web pages for the Download.
References
=B7 One can make Screenshots simply by pressing the key at the same
time ,,pressure/print screen "and/or <Alt> and ,,pressure/print
screen "(the screen and/or the active window copies as diagram into
the intermediate file, so that these can be inserted in Word over
Edit->Past as picture directly).
=B7 The aim for this program is to show as simple text edition as
shown in the example TicTacToe (see C++ program
simpleTicTacToe.cpp).
=B7 In the simplest case the computer player can make coincidental
courses (see C++ program zufallszahlen.cpp (RandomNumbers). A more
intelligent strategy for the computer player can be programmed
according to the mini max algorithm (e.g. see.
http://de.wikipedia.org/wiki/
http://en.wikipedia.org/wiki/Minimax_algorithm). An improved variant
for this algorithm is the alpha beta search (e.g. see
http://en.wikipedia.org/wiki/Alpha-Beta). Tag: automatically rename Tag: 266656
Packet split
Hi all,
I have a problem recieving data from a host machine. I m usiing socket
programing. I formed a packet on host machine.
When i run the application on the local machine (both server and client) I
reiceve all data and packets.
When i run the server on a remote machine i recieve less size data than
expected once a while.
I should recieve a packet size of 1118. sometime i recieve two packets with
the size of 342 and 746. I dont figure it out why i recieve like this.
Any help would be great.
Thanks,
thiru Tag: automatically rename Tag: 266654
Linker Warning
Hi !!! I am using Microsoft Visual C++ 8.0 compiler. I have precompiled
headers file "precomp.h" and "precomp.cpp". When I compile I have
always this warning "precomp.cpp: no public symbols found, archive
members will be inaccessible". I know that by other empty files is it
OK, but by precompiled headers file it is OK that I have empty source
file. What should I do, if I want to switch off the warning?
Thanks. Tag: automatically rename Tag: 266652
PeekNamedPipe not working!
I am using PeekNamedPipe on anonymous pipes. It always returns 0 in
lpBytesRead, lpTotalBytesAvail and lpBytesLeftThisMessage even if data
is written in pipe. I want to check if data is available to read,
before making a ReadFile call, so that it does not blocks. Is there
some other way? Tag: automatically rename Tag: 266644
How can i run an .exe on vista which i have designed on win2k3
Hi,
I have developed a VC++ program on win2k3 environment.
When i am running it on Vista then it is giving an error.
"Side by side configuration is not proper"
What it means?
Thanks inadvance for suggestion.
--Durgesh Tag: automatically rename Tag: 266640
non admin FlushFileBuffers for a volume
Hi All,
In our software we need to flush all the data on a removable device(disk
on key). The problem is that when user is non admin we can't obtain
handle to the volume using CreateFile cause of the insufficient
privileges. I'm looking for a work around to cause file/cache manager to
flush all the data.
Btw eject is not an option for us as after flushing we are doing some
operation via disk on keys firmware that cause it to show "private"
folders, if we do this without flush the data is lost on Win2k machines
where Performance check box is by default turned on on disk on keys.
Thanks in advance Tag: automatically rename Tag: 266638
Write text to, split, join, and page count tiffs
Ok, this has been asked over and over again....but i have to ask
because there has to be a better way (without spending $$). First
things first, I'm running many (thousands of) tif images through an
application I have been building. So far, i have used the
Image.GetFrameCount to get page counts and write strings on images,
split, and join using the graphics object. For anyone that has used
either of these, it is incredibly slow especially compared to some of
these 3rd party libraries that you can purchase for hundreds to
thousands of dollars....seems kind of pointless to spend more than $10
on what i need to use them for. I have used FreeImage from
SourceForge, and, compared to namely LeadTools, it is STILL slower for
getting page counts and I cant even do any drawing using the library.
What I am looking for is either a library or an example of how I can
perform these actions with speed as a must. I am primarily a C#
developer but can delve a little in C++. I am willing to do a little
C++ code, so if that helps with a solution please dont let that be a
limit. ANY help in any of these areas is much more appreciated than
you can imagine. Thank you in advance! Tag: automatically rename Tag: 266635
Question about hooking
Hi,
I'm trying to hook another application's window to check for WM_MOVE
messages. Does anyone know of any examples (that arent for keyboard and
mouse hooks)?
I suppose i want to do the same as SPY++, just for fewer messages!
Thankyou in expectation,
James Tag: automatically rename Tag: 266628
Convert TCHAR to integer!
Hello,
As I now know that const or not, either way the parameter is accepted in the
_ttoi() function.
On that note...
Please consider the following code:
===================================================
case WM_COMMAND:
if ((LOWORD(wParam) >= extnl_INT_INPUT_MVars[0].CW2_CV_ID) &&
(LOWORD(wParam) <= extnl_INT_INPUT_MVars[3].CW2_CV_ID) )
//Fetch function!
UpDateSimExtrnlInputs_INT(wParam, lParam, &io,
HWND_CW2_extnl_INT_INPUT_CV);
...other code ....
==================================================
===============================UpDateSimExtrnlInputs_INT()
void UpDateSimExtrnlInputs_INT(WPARAM wParam, LPARAM lParam, IO *io,
HWND HWND_CW2_extnl_INT_INPUT_CV[])
{
int k;
//TCHAR szBufferINPUT[] = _T("12345"); Tried it ! Gives error!
TCHAR szBufferINPUT[10]; //Declare 10 character array
SendMessage(
(HWND) lParam, WM_GETTEXT,
5, (LPARAM)szBufferINPUT ); //Get the text in the control
//The next line should convert the string buffer to an integer
k = _ttoi(szBufferINPUT); //This line gives the error!
}
=====================================================
Here is the error that I get:
c:\_DTS_PROGRAMMING\C_PROGRAMMING\vc++\MY_APPS_LAB\XPPLC\WndProc_CW2.cpp(780):
error C3861: '_ttoi': identifier not found, even with argument-dependent
lookup
I have re-posted this question, and the fellows that answered the previous
post are very welcome to continue with it and I will more that willingly work
on all your feedback. I find the previous post had too many topics and I was
getting confused that's all! :)
I don't disagree with you Brian, hence, yes, gosh, Yes we are in trouble!
I know that the TEXT macro is defined in a few ways like as:
#define _T(x) __T(x)
and so that's where David got the following line:
TCHAR szBufferINPUT[] = _T("12345");
But I get an error on this...
c:\_DTS_PROGRAMMING\C_PROGRAMMING\vc++\MY_APPS_LAB\XPPLC\WndProc_CW2.cpp(768): error C3861: '_T': identifier not found, even with argument-dependent lookup
But you see that SendMessage() will get different text from different
controls. So:
TCHAR szBufferINPUT[] = _T("12345");
can't be so. The buffer has to be filled in with a new values everytime. And
I did try it if you look at the above code!
Anyways I still would appreciate some help on this topic!
Thankyou news groups!
--
Best regards
Robert
--
Best regards
Robert Tag: automatically rename Tag: 266627
Convert TCHAR to const char?
Hello,
I have the following sendMessage that returns text and is stored in a string
of TCHAR type.
==============================================
TCHAR szBufferINPUT[10];
SendMessage(
(HWND) lParam, WM_GETTEXT,
5, (LPARAM)szBufferINPUT );
==============================================
Now, I need to convert this text string to an integer type.... So I fugure
to go with the atoi function!
But the atoi takes in a const char!
I looked in many books for explanations on conversions from TCHAR to const
char.... ya right! Haven't found one!
So I searched the WIndows help and came up with this:
"Remarks
These functions convert a character string to a double-precision,
floating-point value (atof and _wtof), an integer value (atoi, _atoi64, _wtoi
and _wtoi64), or a long integer value (atol and _wtol). "
So I guess my choice would be atoi or _wtoi right?
in either case I getthe following errors respectively:
c:\_DTS_PROGRAMMING\C_PROGRAMMING\vc++\MY_APPS_LAB\XPPLC\WndProc_CW2.cpp(773):
error C2664: '_wtoi' : cannot convert parameter 1 from 'TCHAR' to 'const
wchar_t *'
c:\_DTS_PROGRAMMING\C_PROGRAMMING\vc++\MY_APPS_LAB\XPPLC\WndProc_CW2.cpp(773):
error C2664: 'atoi' : cannot convert parameter 1 from 'TCHAR' to 'const char
*'
Can anyone show me what I need to do for this to work along with a breif
explaination so I can get one step closer to fully understand data types and
their conversions! A little discouraged although axious to learn!
All suggestions appreciated!
--
Kind regards
Robert Tag: automatically rename Tag: 266613
Typelib info for IPersistFile interface ?
Hi:
I need my atl object to implement the IPersistFile interface. Any of
you know where is the Typelib info (*.tlb,*.exe,*.dll,*.ocx,*.ocb file)
for that interface?
Upon OleView tool that interface is provided by ole32.dll, but that
file doesn't have that kind of info embedded.
Thanks in advance.
Regards. Tag: automatically rename Tag: 266612
Quick question!
Hello,
Say I have a break point on the following line of code:
=============================================
static TCHAR szBufferINPUT[10];
for(i=0;i<4;i++)
{
HWND_CW2_extnl_INT_INPUT_CV[i] = CreateWindow( TEXT ("edit"), TEXT("zero"),
WS_CHILD | WS_VISIBLE | WS_BORDER |
ES_LEFT | ES_MULTILINE, extnl_INT_INPUT_MVars[i].ExtnlMVarLeft,
extnl_INT_INPUT_MVars[i].ExtnlMVarTop,
extnl_INT_INPUT_MVars[i].ExtnlMVarRight,
extnl_INT_INPUT_MVars[i].ExtnlMVarBottom,
hwnd,(HMENU)extnl_INT_INPUT_MVars[i].CW2_CV_ID,
((LPCREATESTRUCT) lParam)->hInstance,NULL);
}
===============================================
When the program execution stops at the line above and I view the locals
variables watch, the value of the handle returned from the above statement at
this point is 244842618. Obviously, I only look at the first control for
now... so at, say when i = 0.
So later in my code I click on the first edit control and I have another
break point in the code handling for this control as done so in the following
code:
=================================================
case WM_COMMAND:
if ((LOWORD(wParam) >= extnl_INT_INPUT_MVars[0].CW2_CV_ID) &&
(LOWORD(wParam) <= extnl_INT_INPUT_MVars[3].CW2_CV_ID) )
SendMessage( //***BREAKPOINT HERE***
(HWND) lParam,
EM_GETLINE,
0, (LPARAM) szBufferINPUT );
=================================================
why is it that if I put a break point at SendMessage() line above, the value
of lParam is not 244842618? It is 3212454 instead?
Isn't lParam the child control's handle? Atleast this is what I read! Okay,
okay... I actually read that it was the child Window handle! But isn't that
the same thing?
Why the different handle values?
And the second part of my question is that I am trying to retreive the value
from my edit control.... As you see as I create my edit controls I insert a
default value of "zero" in them!
Why is it that when I run the code above and when I put my cursor over the
szBufferINPUT in the following line of code I get "". Means it is reading
nothing when I expected a "zero" to be read?
SendMessage(
(HWND) lParam,
EM_GETLINE,
0, (LPARAM) szBufferINPUT );
===================================================
[2nd Part of my question]
Also, I have gone through this 6 months ago with some sympathetic news
groups fellows and it still gets the best of me because everytime I see this
I sort of generate a fear of it. But now that it is facing me one more time,
I shall persue more knowledge on it!
***DATA TYPES!***
Okay, lest try this again! If I may politely ask you to be patient, god
knows you all have! :)
***All the edit controls I have created can hold up to 4 characters max!
The help files for the EM_GETLINE message says:
"lParam
Pointer to the buffer that receives a copy of the line. Before sending the
message, set the first word of this buffer to the size, in TCHARs, of the
buffer. For ANSI text, this is the number of bytes; for Unicode text, this is
the number of characters. The size in the first word is overwritten by the
copied line."
But when we look at the prototype of this function it says that lParam
should take a
(LPARAM) or a (LPCTSTR) type right?
But LPCTSTR has been defined as so in the WINNT.H of the Windows files:
===============================================
typedef CONST WCHAR * LPCWCH, * PCWCH, * LPCWSTR, * PCWSTR
and then:
#ifdef UNICODE
....other type def's...
typedef LPCWSTR LPCTSTR
===============================================
So if I declare my string buffer in TCHARs as stipulated above!
static TCHAR szBufferINPUT[10]; //Space for 10 characters!
then how does the prototype parameter accept a TCHAR when it should accept a
LPCTSTR? Because as typedefed above, if LPCTSTR is defined as a LPCWSTR type
and further LPCWSTR is defined as a CONST WCHAR type so then, how is does
the CONST WCHAR type defined as a TCHAR type, which is what we need right?
Could this have something to do why I read "" instead of "zero" in the 1st
part of my question?
Sorry for the lenghty post!
All help appreciated.....
P.S. Sorry for the numerous postings, this month its like almost every line
I try, turns up to be a many hours snag!
--
Best regards
Roberto Tag: automatically rename Tag: 266605
thread
Is there any way to create a thread that does not begin by calling a
function?
I would basically like a thread that starts executing at the current
point in the program.
This would be similar to calling the Unix fork() function but for
threads.
It would help make my code much cleaner.
Thank you. Tag: automatically rename Tag: 266604
CBitmap - Load JPG
Hi there,
I'm using the CBitmap class to load images from file. At current I am
having to use the LoadImage method of User32.dll to load my images but
unfortunately it does not seem to support the loading of any other image
than BMP.
I was just wondering what the normal procedure for loading JPEG's, GIFS
etc into a CBitmap object usuall is?
Nick. Tag: automatically rename Tag: 266599
importing messages from outlook express
how we can import picture messages from outlook express using
dbxMessage in vc++? Tag: automatically rename Tag: 266595
What the....! is going on!
Hello,
This one I just had to post! It must be me again.... but I must know why!
Check this out:
====================================
case WM_COMMAND:
//IF EXIT BUTTON CLICKED THEN EXIT APPLICATION
if (LOWORD(wParam) == WindowButtonsCW2[0].MW_btC_ID)
DestroyWindow(hwnd); //End application
//UPDATE SIMULATED BOOLEAN INPUTS
else if ((LOWORD(wParam) >= ChkBoxes[0].MW_btC_ID) ||
(LOWORD(wParam) <= ChkBoxes[3].MW_btC_ID) )
UpdatingSimInputs_BOOL(lParam,&io);
//UPDATE SIMULATED INTEGER INPUTS
else if (LOWORD(wParam) == 150)
UpDateSimExtrnlInputs_INT(); //***IT NEVER COMES HERE!!!***
return 0;
==================================================
It never goes to the following line???????????????????????????
UpDateSimExtrnlInputs_INT();
The value of wParam is 16777366, which the LOWORD of this is 150!
I tried it with brackets and no brakets after the if's and else if's, and
same problem!
If I remove all (else if's) then it works, like this:
=============================================
case WM_COMMAND:
//UPDATE SIMULATED INTEGER INPUTS
if (LOWORD(wParam) == 150)
UpDateSimExtrnlInputs_INT(); //***NOW IT COMES HERE!!!***
return 0;
===============================================
This ought to be a good one, I tell ya! :-)
Allfeedback welcome !
Thanks!
--
Best regards
Robert Tag: automatically rename Tag: 266586
const std::map reference and __declspec property
Inside my class, I'm maintaining a private map like this:
std::map< unsigned long, AuthorizedDatabase > m_authorizedDatabases;
The idea is to expose this as a property and be able to reference
individual elements using a syntax like this:
AuthorizedDatabase db = x.AuthorizedDatabases[0x09000112];
Currently, I had a failed attempt at this using a property and an
accessor method:
const std::map< unsigned long, AuthorizedDatabase >&
GetAuthorizedDatabases() const;
__declspec( property( get=GetAuthorizedDatabases ) ) const std::map<
unsigned long, AuthorizedDatabase >& AuthorizedDatabases;
This obviously won't work because I'm returning a const map reference
and the operator[] is non-const because it can modify the map. I'd
rather not return a non-const reference that could be modified, and I'd
also like to avoid returning a complete copy of the map.
Is there any container class better suited to this that has an
operator[] that can be used on a const version of the object?
Alternatively, is there a better way to go about accomplishing this?
Thanks,
-Matthew Tag: automatically rename Tag: 266584
using tryparse
Hello everyone,
I've got a little problem, I'm programming in visual c++ and I try to
get back some numbers from a form using tryparse. It works perfectly on
my computer because the configuration is an english one. But on a
french configuration where the dot of floats is a comma it doesn't
work.
I mean it works with a comma but I would like to stay in an english
configuration with the dot.
Thanks for your help
--
ryo Tag: automatically rename Tag: 266578
customize setting for \t escape sequence
Hello,
I am using MSVC C++ .NET. I am trying to write a simple console program
using cout to display text to the console window. When I try to use the \t
escape sequence, it gives me 3 spaces. I would like it to give me 4 spaces.
How do I change this? Step by Step wallthrough or a link to a step by step
"dummy" proof walk through would be GREAT!
Thank you,
--
Geoff
glhart\\@\\hotmail.\\com Tag: automatically rename Tag: 266575
"edit" control is read only?
Hello,
I am using the edit class as I am creating a control as so:
==============================================
static HWND HWND1;
LRESULT xxx;
HWND1 = CreateWindow( TEXT ("edit"), TEXT("zero"),
WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT | ES_MULTILINE, 10,10,50,30,
hwnd,(HMENU)800,
(HINSTANCE) GetWindowLong(hwnd,GWL_HINSTANCE),NULL);
//Set the control as non read only!
xxx = SendMessage(
(HWND) HWND1, // handle to destination control
(UINT) EM_SETREADONLY, // message ID
(WPARAM) false, // = (WPARAM) () wParam;
(LPARAM) 0); // = 0; not used, must be
zero );
===================================================
Can anyone tell me why the edit control created with CreateWindow appears as
read only. I don't see a flashing cursor in the control, nor can I type text
in it!
I know the above code is not much for you fellows to work with, however
before I spend 4 hours reducing my project to a few compilable lines, If I
may politely ask! I was just wondering if someone had this problem already
where its solution would be an obvious and simplistic one! If not well, just
let me know and its no problem, I will crunch it down to more of an
analysable and compilable size!
Also, xxx reurns a 1, apparently if the function fails, it should return a
0. So I guess my control is not set as read only! But why is it still read
only?
My code is 99% the same as the POPPAD1.C from M. Petzold's hand book! P.396.
The only difference is that as a whole, my application is much larger and I
am doing this on a child window where as he is doing it on the main wndProc
window. I don't think this should make a difference.... But I could be wrong!
All feedback for this is appreciated.
Wish you all a nice day! :)
--
Best regards
Robert Tag: automatically rename Tag: 266560
Are std::list and std::map safe to export?
Is it safe to export a class containing public std::list and std::map
members and suppress the C4251 warning?
I've seen mixed results in my search for an answer. Some say to
explicitly export an instantiation
(http://support.microsoft.com/kb/q168958/) for vectors, but the
remaining STL classes cannot be exported. Others have suggested
disabling the warning or explicitly exporting instantiations of all
related STL classes
(http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html).
What's the general consensus on using the various STL classes from
across DLL boundaries?
Thanks,
-Matthew Tag: automatically rename Tag: 266558
returning a char buffer from com object
I have a COM object with a method:
STDMETHODIMP CIMyAPI::GetValueA(CHAR * string, UINT * nMaxLen)
{
*nMaxLen = sprintf_s(string, *nMaxLen, "Hello");
return S_OK;
}
but, when I call this method from a class that instantiates my COM
object like this:
SomeFunction()
{
IIMyAPIPtr pIMyAPI;
//...
CHAR stringA[32] = {'\0'};
UINT len = sizeof(stringA);
hr = pIMyAPI->GetValueA(stringA, &len);
//...
}
stringA just contains "H" and not "Hello".
So, how do I get a buffer in and out of a COM object?
-PaulH
If it helps, my IDL definition for this function is:
[id(4), helpstring("method GetValueA")] HRESULT GetValueA([out] CHAR *
string, [in,out] UINT * nMaxLen); Tag: automatically rename Tag: 266549
Kill debug for single module
Hi,
I am having a problem with a certain DLL (thats basically littered with
badly placed interupts / breakpoints) and I would like to disable the
debugger picking them up for just the one DLL.
Is this possible? if so would someone explain to me how to acomplish this in
Visual Studio 2005.
Cheers
--
- Mark Randall
http://www.temporal-solutions.co.uk
"We're Systems and Networks..."
"It's our job to know..." Tag: automatically rename Tag: 266547
Slow function
I'm creating an application that will be calling a function that
takes about a minute or so to process some data. What is the standard
procedure for doing something like this in Windows? I don't want the
Graphical User Interface to freeze up or anything like that.
I'm guessing that I can create a new thread to call the function
using CreateThread and then pop up a modal dialog box telling the user
to wait. Or is there a better way of doing this?
Thank you. Tag: automatically rename Tag: 266541
Link problem
I recently moved a project from VS6 to VS2005 and am now receiving:
libguide.lib(z_Windows_NT-586_util.obj) : error LNK2001: unresolved external
symbol __iob
How can I resolve this?
Thanks,
Drew Tag: automatically rename Tag: 266538
creating a .tlb to for a COM DLL
I'm working on a COM object DLL with VS2005, it compiles fine with no
errors or warnings and registers okay, but no .tlb file is created with
it.
When I go to import it with a test app (#import "mydll.dll"), I get the
compiler error
"fatal error C1083: Cannot open type library file: 'mydll.dll': Error
loading type library/DLL."
I assume it's because there's no .tlb associated with it???
Because midl is build in to VS2005, I figured everything would "just
work". I am using the /tlb "mydll.tlb" option and I have all the
error-checking options turned on.
Is there something else I need to do? Is there an obvious thing I'm
doing wrong, perhaps? I did notice that midl, on warning lv 4 only,
does have 32 warnings about "warning MIDL2111 : identifier length
exceeds 31 characters :". Would that keep the .tlb from forming?
Thanks,
PaulH Tag: automatically rename Tag: 266531
multifile program organization
All my previous programs have had the classes and main() in the same
.cpp file. For the first time, I have separated the classes into
header (.h) and source (.cpp) files. My general question is: if I want
to have two separate application programs (i.e. main() ) that will use
these classes, what is the standard way of organizing the various
files? Should I (1) add a new workspace to the original project
folder, thereby, having two workspaces and their respective files in
the same project folder? (2) add a new project folder to the original
folder? (3) put the class files in a separate folder, then have two
separate project folders for the two different application programs?
I would just like to know what the standard practice is.
(I use MS VC 6.0.) Tag: automatically rename Tag: 266526
Is there any way to rename a variable in VC++ so it gets automatically
renamed throughout the code?