|
I stepped into the readLine(). It reads all the lines til the last one. For some odd reasons, it doesn't get the last '\n'. As the result, it tries to read an extra line. Since the next reading doesn't have a '\n' within the buffer size, it crashes.
|
|
|
|
|
Can someone help? I am stuck with this bug.
|
|
|
|
|
Hi All,
I'm not having a lot of luck declaring a combo box in the class code for my dialog resource. I'm using VC++ ver 2.0, non-MFC, Win32 with SDK calls only. I'm making additions to a large and complex legacy program.
Without the combo box declared in the code, the dialog opens fine when the program launches, but when I add the combo box, I get the following two message boxes:
First:
"Create Dialog failure"
Engineering Note ...
Dialog Creation Error
Be sure that there is a Dialog named, "" amongst the program's resources.
Then: an "OK" box:
Exiting due to Error
[8002] Window Create
Error code-20: Create Dialog failure
When I click on the OK, the entire program exits. I've typed the three last lines of each above, letter-for-letter from the messages displayed.
In my class in my .h file, I've declared the following:
ComboBox m_PhNoComboBox;
I added the following to my constructor in my .cpp file:
m_PhNoComboBox (this, WMM_IDC_MND_PHNOS_COMBO)
right after the constructor's function identifier and parameters line and the code builds, but gives that run-time error.
Does anyone have any idea what might be causing this? Should anything else be added?
Searching, I found nothing relevant about the error codes 8002 and 20.
Here's how I'm declaring the combo box in the resource description:
-------------------
WMM_MY_DIALOG DIALOG DISCARDABLE 101, 36, 296, 201
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "My Dialog"
FONT 8, "MS Sans Serif"
BEGIN
COMBOBOX WMM_IDC_MND_PHNOS_COMBO,137,22,137,164,CBS_DROPDOWN | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Close",IDCANCEL,15,177,32,14
END
-------------------
Best regards,
|
|
|
|
|
check the WMM_MY_DIALOG definition in resource.h
|
|
|
|
|
I'm using Windows media player to display movies within my application - which works fine. But I have noticed if I double-click the movie it expands to full screen. Now I don't want that - I want it to stay in the window where I put it. I cannot find a setting that affects this, any ideas?
|
|
|
|
|
Hi Keith
Did you find the answer to your question?
I am trying to do the same thing in vb.net and cannot find a setting that affects this.
Does anyone out there know how to do this?
|
|
|
|
|
No I didn't find an answer.
|
|
|
|
|
hello.
I've a problem with the method GetSaveFileName.
When the option "Hide file extension for know file type" is checked, and the file name contains a ".", the filename is truncated.
here is my code:
OPENFILENAME ofn = {0};
ofn.lStructSize = sizeof(OPENFILENAMEW);
ofn.hwndOwner = (HWND)olhParentHWnd;
ofn.lpstrFilter = "(Doc files)\0*.pkp\0\0";
ofn.nFilterIndex = 1;
ofn.lpstrDefExt = ".pkp";
ofn.lpstrFile = "MyDoc.prefered";
ofn.nMaxFile = _MAX_PATH;
ofn.lpstrTitle = "Save pkp file"
ofn.Flags = OFN_NOREADONLYRETURN | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER | OFN_NOVALIDATE;
ofn.Flags |= OFN_ENABLEHOOK;
ofn.Flags |= OFN_ENABLESIZING;
ofn.lpfnHook = (LPOFNHOOKPROC)CMySavepkpFile::CustomSaveDlgHookProc;
ofn.lpstrInitialDir = "C:\Documents and Settings\Administrator\My Documents";
GetSaveFileName(&ofn);
Unfortunately, the default displayed name is "Mydoc" instead of "MyDoc.prefered".
Any idea ?
|
|
|
|
|
zouzoulikou wrote: ofn.lpstrTitle = "Save pkp file"
You are missing a semicolon.
zouzoulikou wrote: ofn.lpstrInitialDir = "C:\Documents and Settings\Administrator\My Documents";
Why are you not using double backslashes?
zouzoulikou wrote: Unfortunately, the default displayed name is "Mydoc"...
This is expected behavior.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
You're right. I must use double blackslashes. In fact, I've adapted the code before submitting it here.
So the correct code is :
ofn.lpstrInitialDir = "C:\\Documents and Settings\\Administrator\\My Documents";
Note: Any idea for my problem ?
|
|
|
|
|
zouzoulikou wrote: Note: Any idea for my problem ?
What problem? Regardless of the setting, ofn.lpstrFile will contain the correct value (with the extension intact) if the OK button is clicked. You will have to correctly assign that member to a buffer, however, like:
char szBuffer[MAX_PATH] = "MyDoc.prefered";
ofn.lpstrFile = szBuffer;
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
zouzoulikou wrote: OPENFILENAME ofn = {0};
ofn.lStructSize = sizeof(OPENFILENAMEW);
different size isn't it?
|
|
|
|
|
I should write a Windows32 form, in which I can input Unicode. When I create multiple instances of application.all the form must display some content, and When I change the content, the content in all instances must change according to the changed Unicode.
Now I can get the content of input, but how can I put the value into the variable in commen memory area?
#include "stdafx.h"
#include "windows.h"
#include <memory.h>
#include <TCHAR.h>
//#pragma once
#pragma data_seq("Shared")
volatile wchar_t* content;
#pragma data_seq()
#pragma comment(linker, "/Section:Shared,RWS")
namespace ShareMemory2 {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::Button^ button1;
protected:
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->button1 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(67, 26);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(164, 20);
this->textBox1->TabIndex = 0;
//
// button1
//
this->button1->Location = System::Drawing::Point(105, 64);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 1;
this->button1->Text = L"button1";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(296, 111);
this->Controls->Add(this->button1);
this->Controls->Add(this->textBox1);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private : System::String^ Pwchar_tToString(wchar_t* content){
System::IntPtr ptr(content);
System::String^ string = System::Runtime::InteropServices::Marshal::PtrToStringUni(ptr);
return string;
};
private : wchar_t *StringToPwchar_t(System::String^ str){
IntPtr ptr = System::Runtime::InteropServices::Marshal::StringToHGlobalUni(str);
wchar_t *string = reinterpret_cast<wchar_t*>(ptr.ToPointer());
return string;
};
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
/*wchar_t**/ content=TEXT("abc");
//memcpy((void*)content,content2,4);
wchar_t* cont2=TEXT("abc");
int i=0;
this->textBox1->Text=Pwchar_tToString(cont2);
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
wchar_t* in=StringToPwchar_t(this->textBox1->Text);
int i=0;
}
};
}
|
|
|
|
|
You might want to ask this in a more suitable forum.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
ernst20020530 wrote: which forum?
The one that coincides with the language you are using.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Yes I'm using C++ to code, can you help me figure out the idea?
Thanks
|
|
|
|
|
ernst20020530 wrote: ...I'm using C++...
Managed C++.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Try changing:
volatile wchar_t* content;
to:
#define MAX_CONTENT_SZ <some value="">
volatile wchar_t content[MAX_CONTENT_SZ];
i.e. don't dynamically alloc shared data unless you are prepared to handle all multi-proc ownership issues.
...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
|
|
|
|
|
Hi
I have got the following code:
Code:
drawDATA(Shapes shapes, CDC& cd){
// select pen ... ect
// draw shapes
cd.TextOut(X, Y, "DRAW1");
}
I am calling drawDATA from two methods drawA, drawB with: CClientDC dc(this) as parameter.
drawA(shapesA, dc); --> if user invokes action A
Invalidate()
drawB(shapesB, dc); --> if user invokes action B
Invalidate();
both methods draw the shapes, but I only want to show the latest shapes not both shapes of A and B.
If user clicks button A then i should show him shapes A
If he clicks Button B then I should show him shapes B.
If he clicks A , I should show shapes A first, and he continues and clicks B, I should erase shapes A and show shapes B only
SO iI need a way of erasing previous shapes
thank
llp00na
|
|
|
|
|
Invalidate() doesn't redraw your window, it merely tells your window that the whole thing needs to be redrawn the next time the WM_PAINT message is handled.
if you want to erase the background, just fill it with the background color.
|
|
|
|
|
I am drawing on top of a web browser control
So cant use the background colour
I tried UpdateWindow() but does not work
llp00na
|
|
|
|
|
UpdateWindow just sends the WM_PAINT message to your app, it doesn't actually cause painting to happen. basically painting happens whenever your app has nothing else to do and your app gets around to processing the WM_PAINT message. that's not going to happen in the middle of a function (unless you're doing something like an old-school Message Pump between statements).
but, basically, there is no "erase" functionality. there is only draw. if you need to erase drawing A, you have to draw what was there before you drew A.
|
|
|
|
|
llp00na wrote: I am drawing on top of a web browser control
Which means that anytime the Web browser control redraws itself, anything drawn on top of it goes away.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Try RedrawWindow[^] instead of Invalidate...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|