|
|
Or, if you really want to calculate it yourself, simply get the dc when you need to compute the size manually like this:
...
CWnd *pStatic = GetDlgItem(IDC_MY_STATIC_FILENAME);
CDC *pDC = pStatic->GetDC();
pDC->GetTextExtent() or pDC->DrawText(cText,&oRect,DT_CALCRECT....
your calculations...
pStatic->ReleaseDC(pDC);
|
|
|
|
|
How can I calculate the data rate of a video stream in an avi file (contains two streams, one video, one audio) without knowing the audio details in the same way that windows xp does when you right click on the file and look at the properties tab?
|
|
|
|
|
|
geee. some boolean read only flag, checked in mouse button down handler ignoring the click when set? It's not a pretty elegant, but it works
|
|
|
|
|
well, I'd something like
<br />
class CView<br />
{<br />
...
CView()<br />
{<br />
...
m_bviewLocked = false;<br />
}<br />
<br />
bool m_bviewLocked;<br />
}<br />
<br />
void CView::OnToolLock()<br />
{<br />
m_bviewLocked = !m_bviewLocked;
}<br />
<br />
WM_LBUTTONDOWN handler = where you handles the mouse click<br />
{<br />
if( m_bviewLocked ) return 0;
}<br />
or some variantion to this
|
|
|
|
|
hi..
My code is like that,
CRect Panerc;<br />
<br />
m_wndStatusBar.GetItemRect(m_wndStatusBar.CommandToIndex(ID_INDICATOR_ZEK),&Panerc);<br />
<br />
m_edit.Create(ES_LEFT,Panerc,this,5132);
but not work.
HELPPP!!!
|
|
|
|
|
You need to be more specific than "it doesn't work".
From just looking at it, the window styles aren't enough (you need at least WS_VISIBLE|WS_CHILD ), and the parent window is wrong (it should be m_wndStatusBar since that's where the edit box should go).
--Mike--
Latest blog entry: *drool* (Alyson) [May 10]
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
Hello
I want that one button be deactivate(non active) until an other button was clicked on.
How I can do that?
|
|
|
|
|
One solution is messages. Send a message to the control to make it the default control.
Kuphryn
|
|
|
|
|
|
can i use EnableWindow for that?
|
|
|
|
|
If you are using only Win32 API:
1) Get the handle (HWND) of the button to disable/enable
2) Use the EnableWindow function to enable or disable the button.
Enable: EnableWindow(hwndButton, TRUE);
Disable: EnableWindow(hwndButton, FALSE);
If you are using MFC:
Make a call to the EnableWindow member function of the CWnd class. This way, the parameter hwndButton isn't needed. The member function of CWnd only has 1 parameter: the BOOL flag to enable or disable.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
you mean in class wizard?
|
|
|
|
|
No, you cannot use the class wizard here. You have to code it yourself.
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
can you explain more please i am a newbie in visual c++.
|
|
|
|
|
All required dll of MyApp
ADVAPI32.DLL
COMCTL32.DLL
COMDLG32.DLL
GDI32.DLL
KERNEL32.DLL
MSIMG32.DLL
MSVCRT.DLL
NTDLL.DLL
ODBC32.DLL
RPCRT4.DLL
SHELL32.DLL
SHLWAPI.DLL
USER32.DLL
I have a function to do work "Set AutoRun for My Application"
When MyApp run on WinXPpro => Okay => AutoRun on startup
but when it run on Win98SE => Windows show a ERROR MESSAGEBOX instead of MyApp
Error Picture
BOOL SetAutoRun()<br />
{<br />
<br />
#define REG_SUBKEY_AUTORUN "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"<br />
#define REG_VALUE_AUTORUN "Notebook"<br />
<br />
DWORD dwDisposition;<br />
HKEY hkSub;<br />
<br />
CHAR szFullFileName[255]; <br />
GetModuleFileName(NULL,szFullFileName,sizeof(szFullFileName));<br />
<br />
RegCreateKeyEx(HKEY_LOCAL_MACHINE, <br />
REG_SUBKEY_AUTORUN, <br />
0, <br />
STR_NULL, <br />
0, <br />
KEY_READ | KEY_WRITE, <br />
NULL,<br />
&hkSub, <br />
&dwDisposition);<br />
<br />
if(dwDisposition==REG_OPENED_EXISTING_KEY)<br />
{ <br />
if(RegSetValueEx(hkSub,REG_VALUE_AUTORUN, 0,REG_SZ,(LPBYTE)szFullFileName, strlen(szFullFileName)+1) != ERROR_SUCCESS)<br />
{<br />
RegCloseKey(hkSub);<br />
return FALSE;<br />
}<br />
else<br />
{<br />
RegCloseKey(hkSub);<br />
return TRUE;<br />
} <br />
}<br />
<br />
return FALSE;<br />
}
Could you help me to fix this bug?
thank you!
|
|
|
|
|
<br />
Student.obj : error LNK2001: unresolved external symbol "public: void __thiscall Student::Quicksort(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,int)" (?Quicksort@Student@@QAEXPAV?$basic_string@DU?$char_t<br />
raits@D@std@@V?$allocator@D@2@@std@@H@Z)<br />
Debug/Student.exe : fatal error LNK1120: 1 unresolved externals<br />
Error executing link.exe.<br />
<br />
|
|
|
|
|
You're referencing a method called Quicksort(std::string,int) that is defined in one of your headers but isn't actually implemented in one of your .cpp files.
- Mike
|
|
|
|
|
<br />
#ifndef _STUDENT_H<br />
#define _STUDENT_H<br />
<br />
#include <iostream><br />
#include <string><br />
#include "vector.h"<br />
<br />
using namespace std;<br />
<br />
<br />
class Student<br />
{<br />
public:<br />
Student();<br />
string GetName();<br />
void SetInfo(string firstName, string lastName, int SID, int Grade, string Course[], int GradeArr[][6], int i);<br />
void GetGPA();<br />
void GetGrade();<br />
void GetCourseList();<br />
template <typename T><br />
void Quicksort(T a[], int n); <br />
template <typename T><br />
void Quick(T a[], int l, int r);<br />
template <typename T><br />
void print(T a[], int n);<br />
<br />
private:<br />
string sFirstName;<br />
string sLastName;<br />
int iSID;<br />
int iGrade;<br />
int iGradeArr [2][6];<br />
string sCourse [6];<br />
int numCourse;<br />
};<br />
<br />
#endif // _STUDENT_H not defined<br />
<br />
<br />
##########################<br />
#include "student.h"<br />
#include <iostream><br />
#include <string><br />
<br />
using namespace std;<br />
<br />
<br />
<br />
Student::Student()<br />
{<br />
<br />
}<br />
<br />
void Student::SetInfo(string firstName, string lastName, int SID, int Grade, string Course[], int GradeArr[][6], int i)<br />
{<br />
for (int k=0; k< i; k++)<br />
{<br />
sCourse[k]=Course[k];<br />
}<br />
<br />
sFirstName = firstName;<br />
sLastName = lastName;<br />
for (k=0; k< i; k++)<br />
{<br />
iGradeArr[0][k]= GradeArr[0][k];<br />
iGradeArr[1][k]= GradeArr[1][k];<br />
}<br />
iSID= SID; <br />
iGrade= Grade;<br />
numCourse=i;<br />
}<br />
<br />
string Student::GetName()<br />
{<br />
return sFirstName +" "+ sLastName;<br />
}<br />
<br />
void Student::GetGrade()<br />
{<br />
cout<< iGrade<< " "<< iSID<< endl;<br />
<br />
}<br />
<br />
void Student::GetGPA()<br />
{<br />
double iGPA= 0;<br />
<br />
for(int sem1=0; sem1< 2; sem1++)<br />
{<br />
for(int grades=0; grades< numCourse; grades++)<br />
{<br />
if (iGradeArr[sem1][grades] >100)<br />
{<br />
cout<< "A++";<br />
iGPA+=5;<br />
}<br />
else if (iGradeArr[sem1][grades] >= 90)<br />
{<br />
cout<< 'A';<br />
iGPA+=4;<br />
}<br />
else if (iGradeArr[sem1][grades] >= 80)<br />
{<br />
cout<< 'B';<br />
iGPA += 3;<br />
}<br />
else if (iGradeArr[sem1][grades] >= 70)<br />
{<br />
cout<< 'C';<br />
iGPA += 2;<br />
}<br />
else if (iGradeArr[sem1][grades] >= 60) <br />
{<br />
cout<< 'D';<br />
iGPA += 1;<br />
}<br />
else if (iGradeArr[sem1][grades] < 60)<br />
{<br />
cout<< 'F';<br />
iGPA +=0;<br />
}<br />
<br />
}<br />
}<br />
cout<< endl;<br />
cout<< iGPA<< endl;<br />
int totalcredits= 0;<br />
totalcredits +=iGPA;<br />
cout<< iGPA/(numCourse+1);<br />
}<br />
<br />
template <typename T><br />
void Student::GetCourseList()<br />
{<br />
Quicksort(sCourse, numCourse);<br />
}<br />
<br />
template <typename T><br />
T Quicksort(T a[], int n)<br />
{ <br />
<br />
Quick(a, 0, n-1);<br />
<br />
} <br />
<br />
<br />
template <typename T><br />
void Student:: Quick(T a[], int l, int r)<br />
<br />
{ <br />
<br />
if (l >= r) return;<br />
int i, j;<br />
int num_left, num_right;<br />
T pivot, temp;<br />
<br />
while (l < r)<br />
{<br />
i = l;<br />
j = r + 1;<br />
pivot = a[l];<br />
while (true)<br />
{<br />
do<br />
{<br />
i = i + 1;<br />
}<br />
while (a[i] < pivot);<br />
<br />
do<br />
{<br />
j = j - 1;<br />
}<br />
while (a[j] > pivot);<br />
<br />
if (i >= j) break;<br />
temp = a[i];<br />
a[i] = a[j];<br />
a[j] = temp;<br />
}<br />
<br />
a[l] = a[j];<br />
a[j] = pivot;<br />
<br />
num_left = (j-1) - l;<br />
num_right = r - (j+1);<br />
<br />
if (num_left <= num_right)<br />
{<br />
Quicksort(a, l, j-1);<br />
l = j+1;<br />
}<br />
else<br />
{<br />
Quicksort(a, j+1, r);<br />
r = j-1;<br />
}<br />
}<br />
<br />
} <br />
<br />
template <typename T><br />
void Student:: print(T a[], int n)<br />
<br />
<br />
{ <br />
int i;<br />
<br />
for (i = 0; i < n; i++)<br />
{<br />
cout << a[i] << " ";<br />
}<br />
cout << endl;<br />
<br />
<br />
} <br />
##############################<br />
#include <iostream><br />
#include <fstream><br />
#include "vector.h"<br />
#include "student.h"<br />
<br />
using namespace std;<br />
<br />
int main()<br />
{<br />
Vector<Student> Class(6);<br />
<br />
string filename = "student.txt";<br />
ifstream input(filename.c_str());<br />
if (input.fail())<br />
{ cout << "could not open " << filename << " for reading" << endl;<br />
exit(1);<br />
}<br />
<br />
string Course[6], firstName, lastName; <br />
int SID, Grade, GradeArr[2][6];<br />
<br />
int k=0, i=0;<br />
while (!input.eof())<br />
{<br />
input>> firstName>> lastName>> SID>> Grade;<br />
input>> Course[i];<br />
<br />
while(Course[i] != ";")<br />
{<br />
input>> GradeArr[0][i];<br />
cout<< GradeArr[0][i];<br />
input>> GradeArr[1][i];<br />
cout<< GradeArr[1][i];<br />
i++;<br />
input>> Course[i];<br />
<br />
}<br />
Class[k] = Student();<br />
Class[k].SetInfo(firstName, lastName, SID, Grade, Course, GradeArr, i);<br />
k++;<br />
}<br />
cout<< Class[0].GetName()<< endl;<br />
Class[0].GetGrade();<br />
Class[0].GetCourseList();<br />
Class[0].GetGPA();<br />
<br />
<br />
return 0;<br />
}<br />
#################################<br />
<br />
#ifndef _VECTOR_H<br />
#define _VECTOR_H<br />
<br />
#include <cstdlib><br />
#include <cassert><br />
#include <iostream><br />
using namespace std;<br />
<br />
<br />
template <class Item> class Vector<br />
{<br />
public:<br />
Vector()
{<br />
myLength = 0; myList = 0;<br />
}<br />
<br />
Vector(int size)
{<br />
myLength = size;<br />
myList = new Item [size];<br />
assert(myList != 0);<br />
}<br />
<br />
Vector(int size, Item fillValue)
{<br />
myLength = size;<br />
myList = new Item [size];<br />
assert(myList != 0);<br />
for(int k = 0; k < size; k++){<br />
myList[k] = fillValue;<br />
}<br />
}<br />
<br />
Vector(const Vector<Item> & vec)
{<br />
<br />
myList = new Item [myLength = vec.myLength];<br />
assert(myList != 0);<br />
<br />
for(int k = 0; k < vec.myLength; k++)<br />
{<br />
myList[k] = vec.myList[k];<br />
}<br />
}<br />
<br />
~Vector ()
{<br />
delete [] myList;<br />
myList = 0;<br />
myLength = 0;
}<br />
Vector & operator = (const Vector<Item> & vec)
{<br />
if (this != &vec)
{<br />
delete [] myList;
myList = new Item [myLength = vec.myLength];<br />
assert(myList != 0);<br />
<br />
myLength = vec.myLength;<br />
for(int k=0; k < myLength; k++)<br />
{<br />
myList[k] = vec.myList[k];<br />
}<br />
}<br />
return *this;<br />
}<br />
<br />
int Length() const
{<br />
return myLength;<br />
}<br />
int length() const<br />
{<br />
return Length();<br />
}<br />
<br />
void Fill(Item fillValue)<br />
{<br />
int k;<br />
for(k=0; k < myLength; k++)<br />
{<br />
myList[k] = fillValue;<br />
}<br />
}<br />
<br />
void SetSize(int newSize)
{<br />
int numToCopy = newSize < myLength ? newSize : myLength;<br />
<br />
Item * newList = new Item[newSize];<br />
assert(newList != 0);
<br />
int k;<br />
for(k=0; k < numToCopy;k++)<br />
{<br />
newList[k] = myList[k];<br />
}<br />
<br />
delete [] myList;
myLength = newSize;<br />
myList = newList;<br />
}<br />
<br />
void resize(int newSize)<br />
{<br />
SetSize(newSize);<br />
}<br />
<br />
Item & operator [] (int index)<br />
{<br />
if ((unsigned) index >= (unsigned)myLength || index < 0)<br />
{<br />
cerr << "Illegal vector index: " << index<br />
<< " (max = " << myLength-1 << ")" << endl;<br />
assert(index >= 0);<br />
assert(index < myLength);<br />
}<br />
<br />
return myList[index];<br />
}<br />
<br />
const Item & operator [] (int index) const
{<br />
<br />
if ((unsigned) index >= (unsigned)myLength || index < 0)<br />
{<br />
cerr << "Illegal vector index: " << index<br />
<< " (max = " << myLength << ")" << endl;<br />
assert(index >= 0);<br />
assert(index < myLength);<br />
}<br />
<br />
return myList[index];<br />
}<br />
<br />
<br />
private:<br />
Item * myList;
int myLength;
};<br />
<br />
#endif // _VECTOR_H not defined<br />
<br />
<br />
<br />
|
|
|
|
|
today I'm in clinical raven-dead, but I'd check the fact, that:
compiler expects:
Quicksort(std::string,int)
you defines template
T Quicksort(T a[], int n)
couldn't be the array the problem?
What it generates is
std::string Quicksort(std::string a[], int n)
which doesn't actually match the required fn I guess.
But I might be wrong after actualy no-sleeping nigth
|
|
|
|
|
Do I need to have Visual Studio .NET in order to use XP Manifests, or Visual Studio 6.0 is enough?
MSDN explains how to use a manifest and tried it with VS 6.0 but it doesn't work. I still get the old theme.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
|
Thank you very much. Downloading that now.
I created a new project (thru WTL AppWizard) with a manifest, compiled it (no changes made to it), and still I don't have an XP style. Am I missing something?
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
|