|
No single function is called. The OS runs the EXE and passes full path to the file on the command line.
|
|
|
|
|
Is it possible to get the command line path? Because, I want to initialize some variables.
Thanks & Regards,
Suman
|
|
|
|
|
It's a parameter to WinMain(), or you can call GetCommandLine()
|
|
|
|
|
Thank you very much for great help!
Thanks & Regards,
Suman
|
|
|
|
|
Hi~!!
I'am Korean. Not Use English. So I can't English well.
I have problem. like subject.
i need to setting Mixer.(MFC Programing)
but i don't know how setting Front Mic in coding.
each computer are different. one thing in inline-list, otherwise anoter in mic-volume.
so it is hard to solve. my word is diffent to setting Front-Mic.
Help me. please.
d
|
|
|
|
|
My program generates the message
"Windows has triggered a breakpoint in your application. This may be due to corruption of the heap, and indicates a bug in the application or any of the dll's it has loaded...."
The question is, there are no memory leaks, so what kinds of misbehavior cause this?
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
Stuff like this:
int *pInt = new int;
memset(pInt, 0, sizeof(6*sizeof(int)));
Here I only allocate enough space for one integer but write past the end of the memory I allocated.
My advice is to download WinDBG[^] and turn on the page heap for your application. Follow these steps to do so (after installing WinDBG).
1. In the start menu find "Debugging Tools for Windows" and run the "Global Flags" application that's within it.
2. Select the "Image File" tab.
3. In the "Image: (TAB to refresh)" edit control enter the name (not the full path) of your application including the file extension.
4. Press TAB.
5. Tick the following: "Enable heap tail checking", the "Enable heap free checking", "Enable heap parameter checking", ""Enable heap validation on call", "Disable heap coalesce on free" and "Enable page heap".
6. Click "Apply".
7. Debug the application and reproduce the fault. If all goes well a beakpoint will be generated near the code that actually caused the problem.
When done untick all the options and click "Apply". Another option (which I prefer) is to find the registry key "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options" and delete the key named after your application.
Be aware that turning on these options on will make you application run very slowly and consume heaps of memory. It's normally good to have a machine loaded up with RAM.
Steve
|
|
|
|
|
Thank you very much Steve, for all that information! It is much appreciated. I will try that right away.
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
I'm getting a debug assertation error on my MFC program. It compiles fine with no warnings or anything, but I'm still getting the error. When I hit "retry" it points to this line:
Background_dcPtr->DrawText("It Works!", ItWorksDimensions, DT_CENTER);
The rest of the code is here:
#include "game_interface.h"
#include <afxwin.h>
#include "game_ids.h"
using namespace std;
CGameWin::CGameWin() : CGameKeyBindingDialog("CKeyboardDialog")
{
Create(NULL, "Ard-Ri", WS_OVERLAPPEDWINDOW,
rectDefault, NULL, "Game");
CGameKeyBindingDialog.setMainWnd(this);
OffSetX, OffSetY = 0;
}
CDC* CGameWin::DrawBackground()
{
CDC* Background_dcPtr = new CDC;
CRect ItWorksDimensions;
ItWorksDimensions.left = 0;
ItWorksDimensions.top = 0;
ItWorksDimensions.right = 50;
ItWorksDimensions.bottom = 20;
Background_dcPtr->DrawText("It Works!", ItWorksDimensions, DT_CENTER);
return Background_dcPtr;
}
afx_msg void CGameWin::OnPaint()
{
CPaintDC Screen(this);
CRect WindowArea;
CDC* Background = NULL;
GetClientRect(&WindowArea);
OffSetX = WindowArea.right / 4;
OffSetY = WindowArea.bottom / 4;
Background = DrawBackground();
Screen.CreateCompatibleDC(Background);
Screen.BitBlt(OffSetX, OffSetY, OffSetX + 50, OffSetY + 20, Background, 0, 0, SRCCOPY);
delete Background;
}
afx_msg void CGameWin::OnExit()
{
SendMessage(WM_CLOSE);
}
BEGIN_MESSAGE_MAP(CGameWin, CFrameWnd)
ON_WM_PAINT()
ON_COMMAND(IDM_EXIT, OnExit)
END_MESSAGE_MAP()
CGameKeyBindingDialog::CGameKeyBindingDialog(char* lpszName) : CDialog(lpszName)
{
}
BOOL CGameKeyBindingDialog::OnInitDialog()
{
CDialog::OnInitDialog();
return TRUE;
}
CGameWin* CGameKeyBindingDialog::getMainWnd()
{
return m_pMainWnd;
}
void CGameKeyBindingDialog::setMainWnd(CGameWin* mp)
{
m_pMainWnd = mp;
}
afx_msg void CGameKeyBindingDialog::OnExitDialog()
{
EndDialog(IDM_EXIT);
}
BEGIN_MESSAGE_MAP(CGameKeyBindingDialog, CDialog)
ON_COMMAND(IDM_EXIT, OnExitDialog)
END_MESSAGE_MAP()
The header file:
#ifndef GAME_INTERFACE_H
#define GAME_INTEFRACE_H
#include <afxwin.h>
using namespace std;
class CGameWin;
class CGameKeyBindingDialog : public CDialog
{
public:
CGameKeyBindingDialog(char* lpszName);
BOOL OnInitDialog();
CGameWin* getMainWnd();
void setMainWnd(CGameWin* mp);
void InitAll();
afx_msg void OnExitDialog();
private:
CGameWin* m_pMainWnd; //pointer to main window
DECLARE_MESSAGE_MAP()
};
class CGameWin : public CFrameWnd
{
public:
CGameWin();
afx_msg void OnPaint();
//file menu "File"
afx_msg void OnExit();
private:
CDC* DrawBackground();
CGameKeyBindingDialog CGameKeyBindingDialog;
int OffSetX;
int OffSetY;
DECLARE_MESSAGE_MAP()
};
#endif
I'd appreciate any help.
|
|
|
|
|
|
The DC you are drawing text on isn't created. You have a CDC object but no HDC windows object.
You could pass the paint DC to DrawBackground() or in the function get a DC for the window:
CWindowDC* Background_dcPtr = new CWindowDC(this);
...
|
|
|
|
|
Thanks.
|
|
|
|
|
You're welcome
In your OnPaint() function you may want to be careful with the DCs.
You have a CPaintDC whos HDC is already created for the window and then you call
CreateCompatibleDC() on it...not good
Maybe something like this?
void CGameWin::DrawBackground(CDC &dc)
{
CRect ItWorksDimensions;
ItWorksDimensions.left = 0;
ItWorksDimensions.top = 0;
ItWorksDimensions.right = 50;
ItWorksDimensions.bottom = 20;
dc.DrawText("It Works!", ItWorksDimensions, DT_CENTER);
}
afx_msg void CGameWin::OnPaint()
{
CPaintDC Screen(this);
CRect WindowArea;
GetClientRect(&WindowArea);
OffSetX = WindowArea.right / 4;
OffSetY = WindowArea.bottom / 4;
DrawBackground(Screen);
Screen.BitBlt(OffSetX, OffSetY, OffSetX + 50, OffSetY + 20, Background, 0, 0, SRCCOPY);
}
|
|
|
|
|
Can someone tell me how can I make an application in Turbo C to have a title bar and also how can an application run like a service(start with Windows,and to don't have to open it every time you start windows) please?
I am using Turbo C++ 1.01
-- modified at 8:00 Sunday 14th January, 2007
|
|
|
|
|
Microsoft hides all that information and much much more in the
Windows® Platform SDK[^]
More than you ever wanted to know about services can be found here: Services[^]
Turbo C questions may be better answered on a Borland forum
If you have something a little more specific - what you've tried, what didn't work when you tried
it, etc. then you may get some better help here.
Mark
|
|
|
|
|
I have a vague recollection that you can't write Windows apps of any kind in Turbo C, assuming you didn't mean Turbo C++. If you meant the later, the question is if you have the early 90s version or the most recent version. If its the most recent version, use the wizards for a windows app and do some reading on writing services in MSDN for the latter--you can even get sample code from there.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hi there
May i know how to allow horizontal scroll for picture and custom control?
Thanks
|
|
|
|
|
Do you want to scrolls for your image ?
|
|
|
|
|
I want to scroll for the graph(longer that what it can display in one window) that i draw.
May i know how to do this in picture or custom control so that the graph that i drew will be able to scroll properly. What other functions i need to look for? I'm using VC6, dialog app with MFC.
Thanks
|
|
|
|
|
I am creating several PDF reports in my application. Now according to one requirement i want to merge all PDFs in a single PDF. Eg. if there are x.pdf,y.pdf,z.pdf reports i will have to merge them in a file package.pdf so that all the three PDFs will be seen in a single PDF. Any idea?
Any free API available?
Help me please. Thanks in advance.
Jiteen
|
|
|
|
|
i want to read and play it.i want a sample to decode or play wma and wmv files.
sorry because i dont know where to ask it.
thank you.
|
|
|
|
|
wma and wmv files are Advanced Systems Format (ASF) files.
ASF files are covered in the Windows Media Format 11 SDK[^]
There's sample apps in the SDK as well.
If you choose to use DirectShow to play these files there's the DirectShow[^]
SDK (which is now part of the Platform SDK).
If you want to use Windows Media Player there's the Windows Media Player 11 SDK[^]
|
|
|
|
|
I hope a message is sent to parent window when user right clicks a button on CToolBar - so I can display a pop up menu associated with the button.
can a button on CToolBar send message with mouse right-clicking?
if not, any idea to modify CToolBar?
thx
-- modified at 12:48 Saturday 9th December, 2006
|
|
|
|
|
A toolbar sends a NM_RCLICK notification through a WM_NOTIFY message when the user right-clicks
on the toolbar. To get the message in your parent window, add a OnNotify() override to the
parent's class, something like:
BOOL CMyWnd::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
if (wParam == ID_MYTOOLBAR)
{
NMMOUSE *pNMMouse = (NMMOUSE *)lParam;
if (pNMMouse->hdr.code == NM_RCLICK)
{
return TRUE;
}
}
return CWnd::OnNotify(wParam, lParam, pResult);
}
|
|
|
|
|
Now that I've had some caffeine, I thought maybe an easier way would be to let MFC do some of the
work
ON_NOTIFY(NM_RCLICK, ID_MYTOOLBAR, OnToolbarRClick)
...
void CMyWnd::OnToolbarRClick(NMHDR *pNMHdr, LRESULT *pResult)
{
NMMOUSE *pNMMouse = (NMMOUSE *)pNMHdr;
*pResult = (LRESULT)TRUE;
}
|
|
|
|