|
Well, the appwizard is doing the subclassing for you. You'd need to it by hand if, for instance, the control you're subclassing is not known to the wizard, or if you don't add a member variable attached to the control.
As for your other question, seems (after googling around), that you can get hold of the edit control handle by calling GetWindow(hWndCombo, GW_CHILD) , hWndCombo being the handle of the entire combobox (didn't try it myself.) After getting the handle, you can proceed with manual subcassing. Good luck.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
Does anybody know how to debug a console application that needs a filename as an argument e.g.
program.exe filename
I would like to set breakpoints in the code and then run it. I don't know how I can pass the filename as an argument to the program when I start running the program for debugging.
Anybody with ideas?
I am the handsome one in the crowd.
|
|
|
|
|
If you're using VC++ 6, you can go in the Project Settings, on the debug tab. Look for "Command Line Argument" and your in business!!!
Jean Bédard
Optifor Inc.
Québec,Canada
|
|
|
|
|
I am new to activex.
We have activex dialog box with gridcontrol on top of it.
there is no function to access this grid control in interface.
I need to refresh this grid everytime open up this dialog.
I noticed there is a function called findwindow(specified
title name) and get the handle to the window. Now I get the
handle to dialog. can i access this grid control from here?
Thanks,
Shin
|
|
|
|
|
why am i getting this error eventhough i did the following steps to use the mydll
1) go to project->setting->link->typed myDll.lib in the lib/mod
2) copy myDll.lib, myDll.dll, and myDllClassName.h and paste them into the myTesting program dir
3) include "myDllClassName.h"
4) myDllClassName myDllCN;
CString oldstr = "oldstr";
CString newStr;
myDllCN.Function1(oldstr,newStr); //replace original string with the old str and get the new str back
[code]
ERRORSSSSS
Linking...
LINK : warning LNK4075: ignoring /EDITANDCONTINUE due to /INCREMENTAL:NO specification
myDll.obj : error LNK2001: unresolved external symbol ""public: void __thiscall myDll::Function1(class CString,class CString &)" (?Function1@myDll@@QAEXVCString@@AAV2@@Z)
Debug/FH_Testing.exe : fatal error LNK1120: 1 unresolved externals
[/code]
|
|
|
|
|
|
I wrote the dll using c++.net
To test the myDll I open the new project.
in vc++ 6.0
1) i go to project->setting->linkig->insert myDll.lib into the lib/modules.
2) copy .h, .dll,.lib and paste into mytesting project directory
3) go back to mydll and debug with myTesting.exe
Now I have myTesting project created with vc++ .net
how can i test myDll functions is working or not in .Net
Thank you
|
|
|
|
|
There are two type of dll in general.
Win32 DLL and .NET DLL which AKA assemblies.
To use Win32 DLL which you have I presume.
Go to the URL below. It show how to use C# to do it.
http://207.219.70.31/csharp/interop.asp[^]
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
How can I save a window with graphical paints to a jpeg file????
See the code below:
/////////////////////////////////////////////////////////////////////////////////
//gdiplus
////////////////////////////////////////////////////////////////////////
int GetCodecClsid(const WCHAR* format, CLSID* pClsid){
UINT j,num = 0; // number of image encoders
UINT size = 0; // size of the image encoder array in bytes
ImageCodecInfo * pImageCodecInfo = NULL;
GetImageEncodersSize(&num, &size); if(size == 0) return -1; // Failure
pImageCodecInfo = (ImageCodecInfo *)(malloc(size)); if(pImageCodecInfo == NULL) return -1; // Failure
GetImageEncoders(num, size, pImageCodecInfo);
for(j=0; j<num; ++j){="" if(wcscmp(pimagecodecinfo[j].mimetype,="" format)="=0" ){="" *pclsid="pImageCodecInfo[j].Clsid;" return="" j;="" }="" for
=""
="" -1;
}
="" menu="" write
=""
void="" cjanelaview::ongravar()="" {
="" cjaneladoc*="" pdoc="GetDocument();
" cfile="" arquivo;
="" arquivo.open("textando.txt",="" cfile::modecreate="" |="" cfile::modewrite);
="" arquivo.write(pdoc-="">texto,pDoc->texto.GetLength());
arquivo.Close();
CPaintDC dc(this); // device context for painting
using namespace Gdiplus;
Graphics graphics(dc.m_hDC);
Pen blue (Color(255, 0, 0, 255)); Pen red (Color(255, 255, 0, 0)); int y = 256;
for (int x = 0; x < 256; x += 5){
graphics.DrawLine(&blue, 0, y, x, 0);
graphics.DrawLine(&red, 256, x, y, 256);
y -= 5; }
for (y = 0; y < 256; y++){ Pen pen(Color(y, 0, 255,0));
graphics.DrawLine(&pen, 0, y, 256, y);
Sleep(20); }
for (x = 0; x < 256; x++){ Pen pen(Color(x, 255, 0, 255));
graphics.DrawLine(&pen, x, 100, x, 200);
Sleep(20); }
// Write window ----> Image Im(L"fig.gif", FALSE); //
CLSID GifCodec;
GetCodecClsid(L"image/jpeg", &GifCodec);
Im.Save(L"gif.jpg", &GifCodec, NULL);
}
|
|
|
|
|
I use OpenIL for all my image reading and writing. OpenIL supports writing .jpgs and .gifs (and many other formats), though it really helps to be familiar with some OpenGL since OpenIL is sturctured very similarly.
There are quite a few image libraries out there that can handle what you want, so you shouldn't have to reinvent the wheel.
|
|
|
|
|
I need help using scripts in VC++.Net. I am having trouble with the #using mscorlib.dll it says that I need /clr. I don't quite understand how to declare and initialize a string either. I am very new to programming, and would appreciate any help.
Thanks,
Jim
|
|
|
|
|
What's the best method for having resizable boxes that can display images imported by a user?
halblonious
|
|
|
|
|
can you say more ?
resizing an image : there are a number of algo. that does that. you can also use CDC::StretchBlt.
resize the box : CWnd::MoveWindow in response to a WM_SIZE of the view.
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
IF you are on Win2k/XP you have a built-in ready-made solution free of charge:
ShellExecute(NULL,"open","rundll32.exe","C:\\WINDOWS\\System32\\shimgvw.dll,ImageView_Fullscreen c:\\yourimage.jpg",NULL,SW_SHOWNORMAL);
This runs a helper exe (rundll32.exe) which does not do anything except running the specified function from the specified dll which show your pic in the image viewer. The same thing happens when you click on an image file (if Office is not installed, Office registers its own image viewer, but you are free to run shimgvw.dll on your own even then)
Bunburry
|
|
|
|
|
I've got an open source game that's a port of the board game Settlers of Catan, and it uses OpenGL in a CView for the game rendering and GDI over that for information display and user interaction. The game is available at http://www.settlers3d.net and the source is all at SourceForge.net under the project 'settlers3d'.
I am now in the process of adding a brand-new expansion to the game and I want to have a separate 3D rendering of the progress of a certain ship piece over a certain tile (called the 'barbarian attack' in the game). This rendering will be informational only and totally static, meaning the users can't interact with it like they do the main CView OpenGL window.
I'm trying to create a new CWnd based OpenGL window for this barbarian attack that is displayed in its own area that overlays the OpenGL CView. (It actually slides in and out from the side of the game window, but that's extemperaneous to the problem.) I have created the new OpenGL CWnd and gotten it to display what I want, however, all of the Windows GDI drawing is now very messed up. Here is a screenshot.
It seems that with the OpenGL CWnd turned on, something is messed up with the display contexts for all of the GDI drawing. If I comment out the Create() call for the OpenGL CWnd, everything works properly again. If I move the application window around with the mouse, the GDI snaps back into correct drawing, but as soon as I do something in the game that changes the GDI information displays, nothing updates properly.
Does anyone have any idea what would cause this? I don't want to clutter up the question with massive source code pastes, but I can post some links to the files on SourceForge if it would help.
|
|
|
|
|
Question #1: How can I create a list of Themes installed in Windows XP? (Similar to the list which appears in Display Properties > Themes).
Question #2: How can I programatically switch between, or apply, a theme to the system? (Without using ShellExecute to bring up Display Properties).
Is there an API for accomplishing these tasks? If not, any ideas of how to do it anyway?
I'm using Visual C++ 6 (or Visual C++ .NET). Thanks in advance!
|
|
|
|
|
Larry Antram wrote:
Question #1: How can I create a list of Themes installed in Windows XP? (Similar to the list which appears in Display Properties > Themes).
After searching MSDN (with no luck) and poking through the Registry on my machine, I've come to the conclusion that to build the list involves doing a FindFirst/FindNext on [Windows]\Resources\Themes\*.msstyles, and perhaps loading a friendly name (string resource) out of each DLL? Am I correct in this assumption?
Larry Antram wrote:
Question #2: How can I programatically switch between, or apply, a theme to the system? (Without using ShellExecute to bring up Display Properties).
I still need help with this one. I know I can use ShellExecute on a .msstyles file to bring up Display Properties, which will allow the user to apply the Theme -- however there has to be another (automatic) way. Any ideas?
|
|
|
|
|
Specifically, I am wondering how to programmatically simulate clicking on a tab in a TabCtrl.
It seems that I should be able to do SetCurSel and then call OnSelchange, but I don't know how to call the OnSelchange (it requires a PNMHDR and LPRESULT).
I know I've seen a way to do this, but I can't remember where or how I found it.
Thanks.
|
|
|
|
|
Check FindWindow and SendMessage
you can do it without calling OnSelChange they system will call it for you
Good luck
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Thanks for the reply, but I have a couple of questions:
I can get the ClassName easy enough (for FindWindow), but I don't know how to get the window name (the window's title). And if I supply NULL (which the Help says you can do), FindWindow returns 0. So where do I get the window name?
Second, why can't I simply use SendMessage through the control itself? The control is mapped to a variable (of type CTabCtrl) called m_tabLists. It doesn't seem to do anything when I use m_tabLists.SendMessage(TCN_SELCHANGE). Do I have to get a CWnd* by using FindWindow and then call SendMessage? Or am I simply using SendMessage wrong? Do I need parameters (wParam and/or lParam) in my SendMessage call? And if so, what are they or how do I find them?
Thanks a bunch.
|
|
|
|
|
I can get a CWnd* by using
CWnd* pWnd = GetDlgItem(IDC_TAB_LISTS) .
But using
LRESULT lRes = pWnd->SendMessage(TCN_SELCHANGE)
still returns 0 (fails) and does nothing.
I'm thinking I'm doing something wrong with regard to SendMessage.
Again, suggestions are greatly welcome. Thanks.
|
|
|
|
|
is it possible and how to generate content of index, find automatically in html help (chm) ?
content of index and find are auto generated in old one (hlp).
thx.
includeh10
|
|
|
|
|
Hi!
First I'm a real newbie to this class stuff but I programmed in c before.
I'm having quite a big project to do so I need some help. Hope u understand what I mean because english isn't my motherlanguage!
I have defined a struct SAMPLE in a let's say sam.h file. I fill this structure in a class.
This is done:
#include "sam.h"
class Sample
{
public:
SAMPLE SampleStruct;
FillStruct(SampleStruct);
}
Now I need the FILLED SampleStruct (it is filled by reading a file) in another class. Also this class is in another .cpp which is not the main .cpp file.
How is this done?
I also wonder how I can fill this struct without calling the FillStruct function in the program. Is there a way to do this automatically?
Maybe u can provide me with some code examples. I'm really lost with this stuff.
If I forgot something don't bother to ask questions!!
I'm using Visual C++ .Net...
Thx for your great help
atzplzw
|
|
|
|
|
the code is not correct, it is strongly recommended to read a c++ book first (there are many free ones on web).
includeh10
|
|
|
|
|