|
Try it :
HWND hwndProgress = GetDlgItem(m_hwnd, IDC_PROGRESS1);
LONG_PTR lStyle = ::GetWindowLongPtr(hwndProgress, GWL_STYLE);
lStyle |= PBS_MARQUEE;
::SetWindowLongPtr(hwndProgress, GWL_STYLE, lStyle);
::SendMessage(hwndProgress, PBM_SETMARQUEE, WPARAM(TRUE), LPARAM(50));
virtual void BeHappy() = 0;
|
|
|
|
|
Thanks for reply but above code is working with MFC application but not win32 application.
In win32 Only blank Progress bar is coming.
I am using VS 2005.
Any help?
|
|
|
|
|
Try to change the control line in your .rc file:
CONTROL "",IDC_PROGRESS1,"msctls_progress32",PBS_MARQUEE,7,7,156,14
...and then send only the PBM_SETMARQUEE message in your init scope
virtual void BeHappy() = 0;
|
|
|
|
|
If I change It display error:
error RC2104 : undefined keyword or key name: PBS_MARQUEE
I defined the PBS_MARQUEE in resource.h , error is not coming but progress bar is still empty and not in marquee mode.
modified on Friday, April 9, 2010 5:44 AM
|
|
|
|
|
Try to set it at the beginning of the .rc file, just for a test :
#define PBS_MARQUEE 8
virtual void BeHappy() = 0;
|
|
|
|
|
ya I did but not working.
Same blank progress bar is coming.
|
|
|
|
|
Is it presented on the test machine ? :
Minimum DLL Version comctl32.dll version 6.00 or later
Minimum operating systems Windows XP
virtual void BeHappy() = 0;
|
|
|
|
|
This file (COMCTL32.DLL) is exist in system32 folder.
File Version is: 5.82.2900.2180
OS -Windows XP
But on the same machine MFC marquee progress bar is working.
Now Please suggest????
|
|
|
|
|
Try to save this file as c:\common.manifest
and set it (c:\common.manifest ) at ProjectSettings->ManifestTool->InputAndOutput->AdditionalManifestFiles :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"
/>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
...or make the same settings as at your MFC project
virtual void BeHappy() = 0;
|
|
|
|
|
Thanks a lot..its working
|
|
|
|
|
This was incredibly helpful. It also seems to be the only place I can find where this is actually documented. Thank you.
|
|
|
|
|
Hi,
I am opening an aspx page using the following code.From that aspx page,i will return some value using Response.Write("hi"); function.I want to get this string.How to get it from the aspx page to VC++.
CInternetSession objInetSession;
char szURL[100];
CStdioFile* objStdFile;
try
{
wsprintf(szURL,"%s","http://101.8.0.24/test/test.aspx");
objStdFile = objInetSession.OpenURL(szURL,1,INTERNET_FLAG_TRANSFER_ASCII ,NULL,0);
}
catch(CInternetException* exp)
{
exp->ReportError(MB_OK,0);
}
Thanks,
|
|
|
|
|
use CHTTPFile and CHTTPConnection.
|
|
|
|
|
Hello, I use this code. It's only a little
different and it should answer your Question.
CInternetSession objInetSession;
CHttpFile *pHttpFile;
CString tmpStr;
char inBuf[10000];
UINT nBytesRead;
try
{
pHttpFile =(CHttpFile *) objInetSession.OpenURL(
CString("http://localhost"),
1,
INTERNET_FLAG_TRANSFER_ASCII,
NULL,
0
);
}
catch(CInternetException* exp)
{
AfxMessageBox((LPCTSTR)"Some thing went astay",0,0);
}
nBytesRead = pHttpFile->Read(inBuf, sizeof(inBuf));
AfxMessageBox(CString(inBuf,nBytesRead));
}
return nRetCode;
|
|
|
|
|
|
Well, you'r entirely welcome.
I am most happy to edify.
|
|
|
|
|
Hi,
I got one CZoomView sample file form code project.Actually i want zoom fucntion in my applcaiton for every view.In tht,initially when i set scrollposition,extra window is appearing.
For example,in OnDraw(),i set background of window as black
CRect mClientArea;
GetClientRect(&mClientArea);
pDC->FillRect(&mClientArea,&CBrush(RGB(0,0,0)));
I set scroolsize as
m_layout.cx = GetSystemMetrics( SM_CXSCREEN );
m_layout.cy = GetSystemMetrics( SM_CYSCREEN );
m_page.cx = m_layout.cx/2; m_page.cy = m_layout.cy/2;
m_line.cx = m_layout.cx/50; m_line.cy = m_layout.cy/50;
SetScrollSizes(MM_TEXT, m_layout, m_page, m_line);
What happended is after execution,when i scroll the horizonatal or vertical scrolls,the window is scrolling more than actual window rect.
More white screen is appearing apart for black background.How can i avoid that? Because while zooming,if user move the scrolls,then extra empty window will appear.i want to avoid that.
Anu
|
|
|
|
|
Anu,
Try this:
// header file: "MyScrollView.h"
#pragma once
class CDoc;
class CMyScrollView : public CScrollView
{
DECLARE_DYNCREATE(CMyScrollView)
DECLARE_MESSAGE_MAP()
public:
CMyScrollView();
virtual ~CMyScrollView();
CDoc* GetDocument();
protected:
virtual void OnDraw(CDC* pDC);
virtual void OnInitialUpdate();
private:
int Height;
int Width;
CBitmap* Bitmap;
CDC* MemDC;
};
// implementation file: "MyScrollView.cpp"
#include "stdafx.h"
#include "MyScrollView.h"
IMPLEMENT_DYNCREATE(CMyScrollView, CScrollView)
BEGIN_MESSAGE_MAP(CMyScrollView, CScrollView)
END_MESSAGE_MAP()
CMyScrollView::CMyScrollView() :
Bitmap(new CBitmap), Width(1000), Height(200), MemDC(new CDC)
{
MemDC->CreateCompatibleDC(NULL);
}
CMyScrollView::~CMyScrollView()
{
delete Bitmap;
delete MemDC;
}
CDoc* CMyScrollView::GetDocument()
{ return (CDoc*)m_pDocument; }
void CMyScrollView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
GetParentFrame()->SetWindowText("CMyScrollView");
CClientDC dc(this);
Bitmap->CreateCompatibleBitmap(&dc, Width, Height);
Bitmap->SetBitmapDimension(Width, Height);
CBitmap* OldBitmap = MemDC->SelectObject(Bitmap);
MemDC->PatBlt(0, 0, Width, Height, BLACKNESS);
CPen WhitePen(PS_SOLID, 1, RGB(255,255,255));
CPen* OldPen = MemDC->SelectObject(&WhitePen);
MemDC->MoveTo(0, 0);
MemDC->LineTo(Width, Height);
MemDC->MoveTo(Width, 0);
MemDC->LineTo(0, Height);
MemDC->SelectObject(OldPen);
CPen RedPen(PS_SOLID, 1, RGB(255,0,0));
OldPen = MemDC->SelectObject(&RedPen);
MemDC->Rectangle(0,0,10,10);
MemDC->SelectObject(OldPen);
CPen GreenPen(PS_SOLID, 1, RGB(0,255,0));
OldPen = MemDC->SelectObject(&GreenPen);
MemDC->Ellipse(Width-20, Height-20, Width, Height);
MemDC->SelectObject(OldPen);
CRect Rect(0,Height-20,20,Height);
CBrush Brush(RGB(0,0,255));
MemDC->FillRect(Rect, &Brush);
MemDC->SelectObject(OldBitmap);
SetScrollSizes(MM_TEXT, CSize(Width, Height));
ResizeParentToFit(TRUE);
}
void CMyScrollView::OnDraw(CDC* pDC)
{
if (Bitmap)
{
pDC->SetStretchBltMode( COLORONCOLOR );
CBitmap* OldBitmap = MemDC->SelectObject(Bitmap);
pDC->BitBlt(
0, 0, Width, Height,
MemDC,
0, 0,
SRCCOPY);
MemDC->SelectObject(OldBitmap);
}
}
|
|
|
|
|
I want to use std::stringstream to format data to a string like sprintf "%02d" as below:
char szWord[MAX_PATH];
int nValue=3;
sprintf(szWord,"%02d",nValue);
How do I do that by std::stringstream?
modified on Friday, April 9, 2010 5:17 AM
|
|
|
|
|
|
stringstream does not print, but iostream does. Try the cout object as follows:
int x(3);
std::cout.setfill('0');
std::cout.setw(2);
std::cout << x << endl;
stringstream is used similarly, but as I said before it writes to memory, not the console.
Edit: did not pick up on the formating earlier.
|
|
|
|
|
There is (I have been told) a way of using an entire dialog template as a resource in another dialog. This would be very usefull in organising things like a property sheet in one corner and something else in another place. Has anyone tried the mechanics of this?
Regards,
|
|
|
|
|
You don't use a dialog template as a resource in another dialog - to me this implies merging. I've never seen this done.
What is common is to:
- define the parent dialog template
- on the parent, define where a child dialog is to be placed by using a dummy control
- in the parent WM_INITDIALOG:
- call CreateDialog*() to create the child dialog from its template
- find the dummy control and it's extents
- delete the dummy and resize/position the child dialog to take its place
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
LPWSTR S = L"Hello World!";
for (n = 12; n > 0; n--)
{
if (S[n] == 'W')
{
MessageBox (hwnd, L"Found W!", L"FilePosition", NULL);
}
}
error C2446: '==' : no conversion from 'int' to 'LPWSTR'
|
|
|
|
|
'W' is supposed to be a wide character so use L'W'
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|