|
THere is little reason to use a View class if you're not using Doc/View. Why not just use the CListViewCtrl?
But if you must, yes.. Assuming you're using VC6, just make the constructor and destructor of your CListView derived class public and create one with new, then call Create()
|
|
|
|
|
|
Hi all,
I use direct draw in an application showind Mpeg2 streams, The images to show are YUV, I use this piece of code to initialize direc draw:
DSURFACEDESC ddsd;
ZeroMemory(&ddsd, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_LIVEVIDEO | DDSCAPS_VIDEOMEMORY;
ddsd.dwWidth = XSize;
ddsd.dwHeight = YSize;
ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat);
ddsd.ddpfPixelFormat.dwFlags = DDPF_YUV | DDPF_FOURCC;
ddsd.ddpfPixelFormat.dwYBitMask = 0xff00ff00;
ddsd.ddpfPixelFormat.dwUBitMask = 0x00ff0000;
ddsd.ddpfPixelFormat.dwVBitMask = 0x000000ff;
ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
ddsd.ddpfPixelFormat.dwFourCC = mmioFOURCC('Y','U','Y','2');
ddsd.ddpfPixelFormat.dwYUVBitCount = DDBD_16;
pDD->CreateSurface(&ddsd, &pOffscreen, NULL));
Well, Create surface gives INVALID_PIXELFORMAT Error. The Video card supports YUY2, and the code works well under a Matrox millenium G200 and a Ati Rage 128.
Does anyone know the problem ??????
Thank you very much.
Carlo.
|
|
|
|
|
Here is my code to launch net.exe:
// Start the child process.
bSuccess=CreateProcess( NULL,"Net.exe send Computer1 Good morning",
NULL,NULL,FALSE,0,NULL,NULL,&si,&pi );
if (!bSuccess)
{
// Here i use GetLastError() -- OK
}
else
{
DWORD dw = WaitForSingleObject(pi.hProcess, INFINITE) ;
if (dw != 0xFFFFFFFF)
{
BOOL bExit = GetExitCodeProcess(pi.hProcess, &dwExitCode) ;
}
}
I want to get the message definition from dwExitCode. For example if
Computer1 do not exits, we have following message from DOS-Prompt :
"This name(alias) is not found on the network"
"see NET HELPMSG 2273 for more information"
To display this message in run time i use this following code
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
dwExitCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
// Process any inserts in lpMsgBuf.Display the string.
MessageBox((LPCTSTR)lpMsgBuf, "Net Sender", MB_OK | MB_ICONINFORMATION );
// Free the buffer.
LocalFree( lpMsgBuf );
But in my code the error number (dwExitCode) is equal 2 ( not 2273 ) and the message which is
display is : "File is not found"
Can anybody help me to define dwExitCode?
Thanks,
|
|
|
|
|
FormatMessage formats the result of GetLastError(). Unless net.exe returns the result of GetLastError(), there's nothing you can do. File not found is 1, and that is the typical return code from a program. 0 for success, 1 or greater for failure.
The best you can do is to use the STARTUPINFO structure parameter of CreateProcess to set your own stdout and capture that.
|
|
|
|
|
I have to write a driver for special printer.
I haven't found any sample project's for Windows Visual C++.
Can anybody help me?
|
|
|
|
|
Does anyone who know how to obtain VC++ Developer Studio 5.0 or 6.0 ? I really need to obtain it desperately. Thanks a million for helping.
|
|
|
|
|
Well, depending on where you are the names might change, but for example here in Hobart we have a place called 'Harvey Norman'. They have rows and rows of boxes full of software, including the latest Visual Studio.
Or you could try ebay, I'm sure lots of people are selling their VS6 now before VS7 causes it's value to drop.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Hi,
I've made small WTL Dialog APP. Release NonUnicode build has about 60kb, but when I run this app and look at TaskManager, there is over 1MB of used memory! What eat so much memory?
|
|
|
|
|
Hi,
I added one property sheet to display/properties dialog box, i am calling
one call back function, on clicking apply button. Apply button become active
when ever user modify any one of the property sheet. But that call back function
called only when user clicks my new property sheet tab.
I want to call that call back function, even if user modify in
the other property sheets.
Thanks,
- Koteswara
Perumalla Koteswara Rao, (B.Tech)
Computer Science & Engineering,
MIG - 305, KPHB colony,
Hyderabad, Inida - 500072
|
|
|
|
|
I am writing a program that makes use of the active desktop. I need to use the interface IActiveDesktop but however I am always getting an undefined error message. I have the correct version of the Shell32.DLL, I have #include shlobj.h in my code. If I replace IActiveDesktop by IContextMenu which is also defined in the same header file - shlobj.h as IActiveDesktop then everything compiles without any problem. Has anybody got any ideas of what is going on.
I am using Visual C++ 6 with SP4.
|
|
|
|
|
You should add WININET.H as soon as posible in your stdafx.h file
#include <afxwin.h>
#include <wininet.h>
Don't forget to clear project and to delete *.pch files
Mike
|
|
|
|
|
Does anyone know where I can get information on how I can store/retrieve images (jpg) in an access database file from a C++ program.
Thanking you in advance.
Happy programming!!
|
|
|
|
|
Hi.
Add to your table field OLE object named "image".
In your program write:
CFile file;
CByteArray array;
BYTE z;
file.Open(.....);
for(int i=0;i<(unsigned int)file.GetLength();i++)
{
file.Read(&z,1);
array.Add(z);
}
COleVariant ole(array);
AddNew();
SetFieldValue("image",ole);
Update();
Probably better idea is to use operator >> to read from CArchive object but I don't know how. Error message ocurs.
|
|
|
|
|
Hi,
I've made small shellextension and it works fine. Next, I want to add propertysheet extension. So I read one Complete Idiot's guide. Because I love WTL, I've tried to use CPropertyPage from WTL in AddPages method of IShellPropSheetExt interface. But when the extension is called, it goes down with "the memory cannot be read" in altwin.h. I cant find a way through. Can anyone help?
HRESULT CDbfExtension::AddPages(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
{
HPROPSHEETPAGE hPage;
CPropertyProppage m_PropPage;
m_PropPage.m_psp.dwFlags|=PSP_PREMATURE;
m_PropPage.SetTitle(_T("DBF INFO"));
hPage=m_PropPage.Create();
if ( NULL != hPage )
{
// Call the shell's callback function, so it adds the page to
// the property sheet.
if ( !lpfnAddPage ( hPage, lParam ))
DestroyPropertySheetPage ( hPage );
}
return S_OK;
}
|
|
|
|
|
Your CPropertyProppage object is going out of scope, so the corresponding window (the page) gets destroyed. You need to move the object out of the AddPages() function.
--Mike--
http://home.inreach.com/mdunn/
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
-- Buffy
|
|
|
|
|
It's true. But when I change the CPropertyPage to a class-member, it happens again. I've found, that my shell/extension is destroyed ( shell calls Release() ) imidietly after AddPages() returns.
Later:
I've found a way but...
m_PropPage.m_psp.dwFlags|=PSP_USEREFPARENT|PSP_PREMATURE;
m_PropPage.m_psp.pcRefParent=reinterpret_cast<uint far*="">(&_Module.m_nLockCnt);
...
The PSP_USEREFPARENT is important, but this also doesn't work.
|
|
|
|
|
Ok, I ran into the same problems when I first did the Idiot's Guide article on property sheet extensions.
If there's anything that needs to persist beyond the lifetime of the extension object (which, as you've seen, gets destroyed before the property sheet appears) then you need to allocate it on the heap. Read over http://home.inreach.com/mdunn/
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
-- Buffy
|
|
|
|
|
Thanks, it wokrs now. I use global variable for the CPropertyPage. There need to be free g_... in DllMain too.
|
|
|
|
|
I program for a hobby and only have Visual C++ 5 with service pack 3 and no there is no way I can afford VC++ 6. Now I keep seeing projects for VC++ 6. I try to build them in 5 and I cannot. Is there any way to update my libs and includes so that I can compile these projects for Visual C++ 6. Or am I out of luck. Hopefully I am not out of luck!
|
|
|
|
|
Hi !!
Just create new project "Win32 Application" with opntion = "An empty project"
after it copy all files from example project to your new ProjectFolder
without *.dsw,*dsp(its just project files info)
Next step :
In "WorkSpace"-window select tab "FileView"
in folder "Source Files" click MouseRightButton and select "Add Files to Folder.." from Menu
and select all needed files ( *.h, *.cpp, *.rc)
Select from VisualStudio menu "Project">"Settings" and in "all configurations"
in the first tab select "Use MFC in....." from ComboBox , press "OK"
Dont forgot coping "RES" folder to your new project.
After it press F7
hopefully i'm did't any mistakes in this Doc )
Sorry my English so....
Good Luck !!
|
|
|
|
|
I'm a flesh VC programer, and now I must add a shortcut
of a program to the desktop using VC++, but I don't know
how to make it.
I need help, please help me.
Thank you very much indeed.
|
|
|
|
|
Check out the IShellLink interface in MSDN.
HTH, Jens
|
|
|
|
|
Hi im working on a project that requires me to use a status bar of type CStatBarCtrl, and in that object it must have 4 panes... 3 of these four panes mush have text in them that is colored differently than the other 2 as kinda a key to let users know what colors mean what..My problem is I have everything working just fine, except the coloring of the text.. This is supposed to turn out very similar to the Visual Source safe show differences dialog text at the bottom of the status bar... If anyone knows anything , help would be greatly appreciated.
Please email me
sincerely
Josh B. Williams
|
|
|
|
|
Not such a stupid question. Probably the fastest for now is to have a look at Julian Smart's page..
http://www.anthemion.co.uk/
and his CEnhStatusBar Class as guide.
Alternatively overide the OnPaint for your status bar and then you will have paint every paint yourself. Or place Static controls on the Status bar and change the text colour in those.
Happy programming!!
|
|
|
|