|
Am I going in the right direction? or what am I missing?
ifstream inClientFile ("diction.txt", ios::binary);
if(inClientFile != sizeof (10000));
{
ofstream outClientFile ("diction.txt", ios::app);
{
for (int a=0; a<=10; a++)
{
for (int aa=0; aa<10; aa++)
outClientFile<
|
|
|
|
|
Andrew Admire wrote:
if(inClientFile != sizeof (10000));
This is not the correct way to check a file's size. I'm not familar with istream /ostream /etc but I would look into the tellg() or tellp() methods.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
sizeof(10000) will only give you the size of an integer (typically 4 bytes). For finding the size of the file opened by ifstream, I've used this trick
inClientFile.seekg(ios::end);
int size = inClientFile.tellg();
Not sure about the parameter to seekg, but it used to work. Don't know if there are any better methods though.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
What about this? However I get a binary error about the !=. Then I tried to just read the file and I get the size 0, however when I look at the size it says 4Gb
ifstream inClientFile ("diction.txt", ios::in);
inClientFile.seekg(ios::end);
int size = inClientFile.tellg();
if (inClientFile != size)ofstream outClientFile ("diction.txt", ios::app);
{
for (int a=0; a<=10; a++)
{
for (int aa=0; aa<10; aa++)
outClientFile<
|
|
|
|
|
Help...
TO get the HTML code and change it on programm...
Tender_Nail
|
|
|
|
|
|
Hi all,
I need to find out at runtime what file types are supported on the target machine by DirectShow, or, alternatively, find out if a given file type (i.e. extension) is being supported.
If somebody could point me in the right direction, this would be greatly appreciated.
|
|
|
|
|
There is really no way of knowing since it is more the type that determines if it can be renderered or not.
You can create yourself a graph and call the renderfile function to see if it fails or not. Other than that, it is not as simple as checking if the file type is registered in explorer...
|
|
|
|
|
I’m using visual studio 7.0 2003 with c++ and MFC.
In the debugger when I’d put the cursor on a CString object I’d automatically see its value. Now, in a new project I only see things like “sql = {…}”.
I have to go down to a watch window where it is defined as
ATL::CSimpleStringT<char,0> and underneath that
m_pszData with the actual data.
Upon further investigation I see it is dependent upon if I use Managed Extensions. Without the managed extensions, I see the CString objects directly under the cursor in the debugger.
If I go to a watch window, it is defined slightly differently
ATL::CSimpleStringT<char,1> and again
m_pszData with the actual data.
Does anyone know what is the meaning of the difference and if I can do something in order to see CStrings like I’ve always seen them?
Thanks,
Ilan
|
|
|
|
|
Hello!
I have a big problem. Since yesterday morning I am experimenting, but i am not able to solve it. Since yesterday morning the VC++ 7.1 Linker (link.exe) shows me the error "Buffer Overrun detected".
It's no matter, which Project I am trying to link nor if I start the Linking from Visual Studio .Net or via the command line (with link.exe)
I already re-installed Visual Studio .Net for 3 times and scanned my Hard-Disks with Antivir PE, AdAware, HiJackthis, Spybot S&D and A-squared for Virus, Malware, Spyware,... and deleted everything it found.
After that I downloaded all from link.exe needed DLLs (msvc71.dll, mspdb71.dll,...) and replaced them, but this didn't solve my problem too.
At Last i tried so find the reason for the Problem with FileMon (www.sysinternals.com) but also without any success.
And no i am at a loss. Except a complete Operating System Reinstall i don't know anything more to solve the problem. Everything looks like it's bewitched.
Has anybode made the same experience?
Does anybody know how to solve this problem?
Many thanks in Advance!
|
|
|
|
|
Hello,
I need to know how to hide a CPropertyPage at runtime in my app. I thought that it could be done by first removing all the pages
while (m_sheet.GetPageCount()) {
m_sheet.RemovePage(0);
}
and than adding the pages (except the one i want to hide) to the sheet again
m_sheet.AddPage(&m_tree, 0);
m_sheet.AddPage(&m_calculate,7);
m_sheet.AddPage(&m_cad,12);
The problem is that removing a page in the way i did will destroy the page and adding the page will recreate it. But I need to hold the state of the page furthermore. Maybe someone has an idea!
Best regards,
Tabor
|
|
|
|
|
See if MSDN article Q151662 helps. I've used it in several of my projects.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thank you very much,
i will check this!
Best regards
Tabor
|
|
|
|
|
sorry couldnt get the article Q151662 .Searched in msdn site and google.too.
Thanx for the info.
Meanwhile I tried a lot to disable the save tool button on the toolbar. I tried SetButtonInfo in the foll. code but in vain.
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME1))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Delete these three lines if you don't want the toolbar to be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_TOP);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
TBBUTTONINFO buttonInfo;
UINT buttonID;
buttonID = ID2_FILE_SAVE;
m_wndToolBar.GetToolBarCtrl().GetButtonInfo(ID2_FILE_SAVE, &buttonInfo);
buttonInfo.fsState = TBSTATE_INDETERMINATE ;
m_wndToolBar.GetToolBarCtrl().SetButtonInfo(ID2_FILE_SAVE, &buttonInfo);
return 1;
}
laiju
|
|
|
|
|
laiju wrote:
sorry couldnt get the article Q151662 .Searched in msdn site and google.too.
Really?
http://support.microsoft.com/default.aspx?scid=kb;en-us;151662
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
|
thanx for the link i have fixed it already.
thanx once again
laiju
|
|
|
|
|
I have a CWnd object which I use for drawing a chart using OpenGL. The CWnd has vertical and horizontal scroll bars and is owned by a formview derived class.
When I open a dialog box above the CWnd object and then close it again, the CWnd object does not refresh (the chart is grey and the scroll bars are blank where the dialog was).
My drawing code function is called by OnPaint. So therefore it appears that when the dialog is closed WM_PAINT is not called!
I've tried called UpdateWindow in PostNcDestroy on the dialog, but this causes a crash.
Any thoughts?
Thanks, James
|
|
|
|
|
try [InvalidateRect] or [CWnd::Invalidate]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Where should I call Invalidate?
If I call it in OnOk() it invalidates the entire CWnd object and makes it blank, without calling OnPaint.
If I call Invalidate in PostNcDestroy it causes a crash!
|
|
|
|
|
i have created a push button using Create Window. Now
1. how do i write text on the button?
2. how do i handle the button WM_COMMAND?
the code snippet is:
WNDCLASS wc;
memset(&wc, 0, sizeof(WNDCLASS));
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC) WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = GetModuleHandle(NULL);
wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); wc.lpszClassName = "WndClassName";
if(!RegisterClass(&wc))
{
MessageBox(NULL,"Failed To Register The Window class.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return (NULL);
}
HWND hWindow = CreateWindowEx(NULL, "WndClassName","DialogClassSample",WS_OVERLAPPEDWINDOW | WS_VISIBLE,0, 0, 320, 200, NULL, NULL, GetModuleHandle(NULL), NULL);
HWND ButtonWindow = CreateWindow("BUTTON",NULL, BS_TEXT|BS_PUSHBUTTON|WS_VISIBLE|WS_CHILD,50,50,30,20,hWindow,NULL,NULL,NULL);
MSG msg;
BOOL bDone = FALSE;
while(!bDone)
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if (msg.message==WM_QUIT)
{
bDone = TRUE;
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
|
|
|
|
|
1. SetWindowText should help you put the text over the button
2. You need to give your Window Procedure where in you can handle the messages (In a way that we use to do in SDK)
<bold>- Nilesh
<italics>
"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
My Window procedure is:
LRESULT CALLBACK WndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) {
switch (uMsg)
{
case WM_COMMAND:
{
PostQuitMessage(0);
return 0;
}
break;
case WM_CLOSE:
{
PostQuitMessage(0);
return 0;
}
break;
}
return DefWindowProc(hWnd,uMsg,wParam,lParam);
}
Here i have handled the WM_COMMAND message.
but my problem is if i create 2 push buttons and i want seperate handling for the buttons, how do i distinguish the WM_COMMAND of one button from the WM_COMMAND of the second button?
|
|
|
|
|
1.Low-order of WParam would be having the button identifier, compare that with the list of id's that you gave at the time of creation
2. Compare your button handle with in coming hwnd parameter
<bold>- Nilesh
<italics>
"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
how do i compare low-order of WParam. i did not create any list of ids. i checked the low-order of WParam. it outputs 0.
Secondly, how do i compare the handle. The button handle is declared in WinMain() and i need to compare in WndProc(i m not able to get the button handle in WinProc)
|
|
|
|